App: Fix GroupSeparator bug
This commit is contained in:
@ -65,22 +65,27 @@ namespace Elwig {
|
||||
MainDispatcher = Dispatcher;
|
||||
Scales = Array.Empty<IScale>();
|
||||
CurrentApp = this;
|
||||
OverrideCulture();
|
||||
}
|
||||
|
||||
protected override async void OnStartup(StartupEventArgs evt) {
|
||||
var locale = new CultureInfo("de-AT");
|
||||
locale.NumberFormat.CurrencyGroupSeparator = "\u202f";
|
||||
locale.NumberFormat.NumberGroupSeparator = "\u202f";
|
||||
locale.NumberFormat.PercentGroupSeparator = "\u202f";
|
||||
private static void OverrideCulture() {
|
||||
var locale = new CultureInfo("de-AT", false);
|
||||
locale.NumberFormat.CurrencyGroupSeparator = Utils.GroupSeparator;
|
||||
locale.NumberFormat.NumberGroupSeparator = Utils.GroupSeparator;
|
||||
locale.NumberFormat.PercentGroupSeparator = Utils.GroupSeparator;
|
||||
CultureInfo.CurrentCulture = locale;
|
||||
CultureInfo.CurrentUICulture = locale;
|
||||
Thread.CurrentThread.CurrentCulture = locale;
|
||||
Thread.CurrentThread.CurrentUICulture = locale;
|
||||
CultureInfo.DefaultThreadCurrentCulture = locale;
|
||||
CultureInfo.DefaultThreadCurrentUICulture = locale;
|
||||
FrameworkElement.LanguageProperty.OverrideMetadata(
|
||||
typeof(FrameworkElement),
|
||||
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))
|
||||
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name))
|
||||
);
|
||||
}
|
||||
|
||||
protected override async void OnStartup(StartupEventArgs evt) {
|
||||
Version = typeof(App).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split("+")[0] ?? "0.0.0";
|
||||
|
||||
try {
|
||||
|
@ -12,7 +12,7 @@ namespace Elwig.Dialogs {
|
||||
InitializeComponent();
|
||||
TextLsNr.Text = lsnr;
|
||||
TextMember.Text = name;
|
||||
TextWeight.Text = $"{weight:N0}\u202fkg";
|
||||
TextWeight.Text = $"{weight:N0}{Utils.GroupSeparator}kg";
|
||||
}
|
||||
|
||||
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Elwig.Helpers;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
@ -14,7 +13,7 @@ namespace Elwig.Dialogs {
|
||||
|
||||
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||
DialogResult = true;
|
||||
Price = double.Parse(PriceInput.Text.Replace("\u202f", ""));
|
||||
Price = double.Parse(PriceInput.Text.Replace(Utils.GroupSeparator, ""));
|
||||
Close();
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,9 @@ namespace Elwig.Helpers {
|
||||
[GeneratedRegex(@"^(.*?) +([0-9].*)$", RegexOptions.Compiled)]
|
||||
private static partial Regex GeneratedAddressRegex();
|
||||
|
||||
public static readonly string GroupSeparator = "\u202F";
|
||||
public static readonly string UnitSeparator = "\u00A0";
|
||||
|
||||
public static readonly KeyValuePair<string, string>[] PhoneNrTypes = [
|
||||
new("landline", "Tel.-Nr. (Festnetz)"),
|
||||
new("mobile", "Tel.-Nr. (mobil)"),
|
||||
|
@ -889,7 +889,7 @@ namespace Elwig.Windows {
|
||||
p.Acid = (AcidInput.Text == "") ? null : double.Parse(AcidInput.Text);
|
||||
p.Comment = (PartCommentInput.Text == "") ? null : PartCommentInput.Text;
|
||||
|
||||
p.Weight = int.Parse(WeightInput.Text.Replace("\u202f", ""));
|
||||
p.Weight = int.Parse(WeightInput.Text.Replace(Utils.GroupSeparator, ""));
|
||||
p.ManualWeighing = ManualWeighingInput.IsChecked ?? false;
|
||||
p.ScaleId = ScaleId;
|
||||
p.WeighingId = WeighingId;
|
||||
|
Reference in New Issue
Block a user