mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Implemented Donate page with wirking (?) in app purchases
Moved Pages to Views
This commit is contained in:
38
ModernKeePass/ViewModels/DonateVm.cs
Normal file
38
ModernKeePass/ViewModels/DonateVm.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel.Store;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Services;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class DonateVm: NotifyPropertyChangedBase
|
||||
{
|
||||
public ObservableCollection<ProductListing> Donations { get; }
|
||||
|
||||
public ProductListing SelectedItem
|
||||
{
|
||||
get { return _selectedItem; }
|
||||
set { SetProperty(ref _selectedItem, value); }
|
||||
}
|
||||
|
||||
private readonly ILicenseService _license;
|
||||
private ProductListing _selectedItem;
|
||||
|
||||
public DonateVm() : this (new LicenseService()) { }
|
||||
|
||||
public DonateVm(ILicenseService license)
|
||||
{
|
||||
_license = license;
|
||||
Donations = new ObservableCollection<ProductListing>(_license.Products.Values.OrderBy(p => /*decimal.Parse(*/p.FormattedPrice/*, NumberStyles.Currency | NumberStyles.AllowDecimalPoint)*/));
|
||||
}
|
||||
|
||||
public async Task<int> Purchase()
|
||||
{
|
||||
return await _license.Purchase(SelectedItem.ProductId);
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,8 +5,8 @@ using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Pages;
|
||||
using ModernKeePass.Services;
|
||||
using ModernKeePass.Views;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
@@ -107,6 +107,13 @@ namespace ModernKeePass.ViewModels
|
||||
PageType = typeof(AboutPage),
|
||||
Destination = destinationFrame,
|
||||
SymbolIcon = Symbol.Help
|
||||
},
|
||||
new MainMenuItemVm
|
||||
{
|
||||
Title = resource.GetResourceValue("MainMenuItemDonate"),
|
||||
PageType = typeof(DonatePage),
|
||||
Destination = destinationFrame,
|
||||
SymbolIcon = Symbol.Shop
|
||||
}
|
||||
};
|
||||
// Auto-select the Recent Items menu item if the conditions are met
|
||||
|
@@ -4,8 +4,7 @@ using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Pages;
|
||||
using ModernKeePass.Pages.SettingsPageFrames;
|
||||
using ModernKeePass.Views;
|
||||
using ModernKeePass.Services;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
|
Reference in New Issue
Block a user