From 50c5940a0a23aa37b8edcb579978a0e64ac196da Mon Sep 17 00:00:00 2001 From: BONNEVILLE Geoffroy Date: Mon, 11 Dec 2017 11:08:33 +0100 Subject: [PATCH] Donations are sorted ascending --- ModernKeePass/ViewModels/DonateVm.cs | 10 +++++++++- ModernKeePass/Views/MainPageFrames/DonatePage.xaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ModernKeePass/ViewModels/DonateVm.cs b/ModernKeePass/ViewModels/DonateVm.cs index 97e7977..7bf3e70 100644 --- a/ModernKeePass/ViewModels/DonateVm.cs +++ b/ModernKeePass/ViewModels/DonateVm.cs @@ -26,8 +26,16 @@ namespace ModernKeePass.ViewModels public DonateVm(ILicenseService license) { + var usNfi = new NumberFormatInfo + { + NegativeSign = "-", + NumberDecimalSeparator = ".", + NumberGroupSeparator = ",", + CurrencySymbol = "$" + }; _license = license; - Donations = new ObservableCollection(_license.Products.Values.OrderBy(p => /*decimal.Parse(*/p.FormattedPrice/*, NumberStyles.Currency | NumberStyles.AllowDecimalPoint)*/)); + Donations = new ObservableCollection( + _license.Products.Values.OrderBy(p => decimal.Parse(p.FormattedPrice, NumberStyles.Currency, usNfi))); } public async Task Purchase() diff --git a/ModernKeePass/Views/MainPageFrames/DonatePage.xaml b/ModernKeePass/Views/MainPageFrames/DonatePage.xaml index 31ade05..e124884 100644 --- a/ModernKeePass/Views/MainPageFrames/DonatePage.xaml +++ b/ModernKeePass/Views/MainPageFrames/DonatePage.xaml @@ -16,7 +16,7 @@ x:Name="DonateItemsSource" Source="{Binding Donations}" /> - +