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