Implemented Donate page with wirking (?) in app purchases

Moved Pages to Views
This commit is contained in:
BONNEVILLE Geoffroy
2017-12-08 19:38:33 +01:00
parent e25f9f4aae
commit 35f64eec1b
48 changed files with 402 additions and 227 deletions

View File

@@ -9,6 +9,7 @@ using Windows.UI.Xaml.Navigation;
using ModernKeePass.Common;
using ModernKeePass.Exceptions;
using ModernKeePass.Services;
using ModernKeePass.Views;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
@@ -103,7 +104,7 @@ namespace ModernKeePass
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(Pages.MainPage), lauchActivatedEventArgs.Arguments);
rootFrame.Navigate(typeof(MainPage), lauchActivatedEventArgs.Arguments);
}
/*else
{
@@ -158,7 +159,7 @@ namespace ModernKeePass
base.OnFileActivated(args);
var rootFrame = new Frame();
Database.DatabaseFile = args.Files[0] as StorageFile;
rootFrame.Navigate(typeof(Pages.MainPage), args);
rootFrame.Navigate(typeof(MainPage), args);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml.Media.Animation;
using ModernKeePass.Exceptions;
using ModernKeePass.Interfaces;
@@ -12,18 +13,11 @@ namespace ModernKeePass.Common
public static async void ShowActionDialog(string title, string contentText, string actionButtonText, string cancelButtonText, UICommandInvokedHandler action)
{
// Create the message dialog and set its content
var messageDialog = new MessageDialog(contentText, title);
var messageDialog = CreateBasicDialog(title, contentText, cancelButtonText);
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
messageDialog.Commands.Add(new UICommand(actionButtonText, action));
messageDialog.Commands.Add(new UICommand(cancelButtonText));
// Set the command that will be invoked by default
messageDialog.DefaultCommandIndex = 1;
// Set the command to be invoked when escape is pressed
messageDialog.CancelCommandIndex = 1;
// Show the message dialog
await messageDialog.ShowAsync();
}
@@ -48,13 +42,35 @@ namespace ModernKeePass.Common
{
if (exception == null) return;
// Create the message dialog and set its content
var messageDialog = new MessageDialog(exception.Message, "Error occured");
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
messageDialog.Commands.Add(new UICommand("OK"));
var messageDialog = CreateBasicDialog("Error occured", exception.Message, "OK");
// Show the message dialog
await messageDialog.ShowAsync();
}
public static async void ShowNotificationDialog(string title, string message)
{
var dialog = CreateBasicDialog(title, message, "OK");
// Show the message dialog
await dialog.ShowAsync();
}
private static MessageDialog CreateBasicDialog(string title, string message, string dismissActionText)
{
// Create the message dialog and set its content
var messageDialog = new MessageDialog(message, title);
// Add commands and set their callbacks;
messageDialog.Commands.Add(new UICommand(dismissActionText));
// Set the command that will be invoked by default
messageDialog.DefaultCommandIndex = 1;
// Set the command to be invoked when escape is pressed
messageDialog.CancelCommandIndex = 1;
return messageDialog;
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.ApplicationModel.Store;
namespace ModernKeePass.Interfaces
@@ -6,5 +7,6 @@ namespace ModernKeePass.Interfaces
public interface ILicenseService
{
IReadOnlyDictionary<string, ProductListing> Products { get; }
Task<int> Purchase(string addOn);
}
}

View File

@@ -117,7 +117,8 @@
<Compile Include="Interfaces\IRecent.cs" />
<Compile Include="Interfaces\IRecentItem.cs" />
<Compile Include="Interfaces\IResource.cs" />
<Compile Include="Pages\MainPageFrames\DonatePage.xaml.cs">
<Compile Include="ViewModels\DonateVm.cs" />
<Compile Include="Views\MainPageFrames\DonatePage.xaml.cs">
<DependentUpon>DonatePage.xaml</DependentUpon>
</Compile>
<Compile Include="Services\DatabaseService.cs" />
@@ -141,22 +142,22 @@
<Compile Include="Interfaces\IDatabase.cs" />
<Compile Include="Interfaces\IHasSelectableObject.cs" />
<Compile Include="Interfaces\ISelectableModel.cs" />
<Compile Include="Pages\BasePages\LayoutAwarePageBase.cs" />
<Compile Include="Pages\SettingsPageFrames\SettingsDatabasePage.xaml.cs">
<Compile Include="Views\BasePages\LayoutAwarePageBase.cs" />
<Compile Include="Views\SettingsPageFrames\SettingsDatabasePage.xaml.cs">
<DependentUpon>SettingsDatabasePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPageFrames\SettingsNewDatabasePage.xaml.cs">
<Compile Include="Views\SettingsPageFrames\SettingsNewDatabasePage.xaml.cs">
<DependentUpon>SettingsNewDatabasePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPageFrames\SettingsSecurityPage.xaml.cs">
<Compile Include="Views\SettingsPageFrames\SettingsSecurityPage.xaml.cs">
<DependentUpon>SettingsSecurityPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPageFrames\SettingsWelcomePage.xaml.cs">
<Compile Include="Views\SettingsPageFrames\SettingsWelcomePage.xaml.cs">
<DependentUpon>SettingsWelcomePage.xaml</DependentUpon>
</Compile>
<Compile Include="TemplateSelectors\FirstItemDataTemplateSelector.cs" />
<Compile Include="Controls\ListViewWithDisable.cs" />
<Compile Include="Controls\CompositeKeyUserControl.xaml.cs">
<Compile Include="Views\UserControls\CompositeKeyUserControl.xaml.cs">
<DependentUpon>CompositeKeyUserControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\TextBoxWithButton.cs" />
@@ -171,20 +172,20 @@
<Compile Include="Events\PasswordEventArgs.cs" />
<Compile Include="Interfaces\IIsEnabled.cs" />
<Compile Include="Interfaces\IPwEntity.cs" />
<Compile Include="Pages\MainPage.xaml.cs">
<Compile Include="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Mappings\PwIconToSegoeMapping.cs" />
<Compile Include="Pages\MainPageFrames\AboutPage.xaml.cs">
<Compile Include="Views\MainPageFrames\AboutPage.xaml.cs">
<DependentUpon>AboutPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\MainPageFrames\NewDatabasePage.xaml.cs">
<Compile Include="Views\MainPageFrames\NewDatabasePage.xaml.cs">
<DependentUpon>NewDatabasePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPage.xaml.cs">
<Compile Include="Views\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\MainPageFrames\WelcomePage.xaml.cs">
<Compile Include="Views\MainPageFrames\WelcomePage.xaml.cs">
<DependentUpon>WelcomePage.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\AboutVm.cs" />
@@ -192,19 +193,19 @@
<Compile Include="ViewModels\Items\ListMenuItemVm.cs" />
<Compile Include="ViewModels\Items\MainMenuItemVm.cs" />
<Compile Include="ViewModels\Items\RecentItemVm.cs" />
<Compile Include="Pages\EntryDetailPage.xaml.cs">
<Compile Include="Views\EntryDetailPage.xaml.cs">
<DependentUpon>EntryDetailPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\GroupDetailPage.xaml.cs">
<Compile Include="Views\GroupDetailPage.xaml.cs">
<DependentUpon>GroupDetailPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\MainPageFrames\OpenDatabasePage.xaml.cs">
<Compile Include="Views\MainPageFrames\OpenDatabasePage.xaml.cs">
<DependentUpon>OpenDatabasePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\MainPageFrames\RecentDatabasesPage.xaml.cs">
<Compile Include="Views\MainPageFrames\RecentDatabasesPage.xaml.cs">
<DependentUpon>RecentDatabasesPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\MainPageFrames\SaveDatabasePage.xaml.cs">
<Compile Include="Views\MainPageFrames\SaveDatabasePage.xaml.cs">
<DependentUpon>SaveDatabasePage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -239,67 +240,67 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Controls\CompositeKeyUserControl.xaml">
<Page Include="Views\UserControls\CompositeKeyUserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPage.xaml">
<Page Include="Views\MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\MainPageFrames\AboutPage.xaml">
<Page Include="Views\MainPageFrames\AboutPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\EntryDetailPage.xaml">
<Page Include="Views\EntryDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\GroupDetailPage.xaml">
<Page Include="Views\GroupDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPageFrames\DonatePage.xaml">
<Page Include="Views\MainPageFrames\DonatePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPageFrames\NewDatabasePage.xaml">
<Page Include="Views\MainPageFrames\NewDatabasePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPageFrames\OpenDatabasePage.xaml">
<Page Include="Views\MainPageFrames\OpenDatabasePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPageFrames\RecentDatabasesPage.xaml">
<Page Include="Views\MainPageFrames\RecentDatabasesPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPageFrames\SaveDatabasePage.xaml">
<Page Include="Views\MainPageFrames\SaveDatabasePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SettingsPage.xaml">
<Page Include="Views\SettingsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\MainPageFrames\WelcomePage.xaml">
<Page Include="Views\MainPageFrames\WelcomePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SettingsPageFrames\SettingsDatabasePage.xaml">
<Page Include="Views\SettingsPageFrames\SettingsDatabasePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SettingsPageFrames\SettingsNewDatabasePage.xaml">
<Page Include="Views\SettingsPageFrames\SettingsNewDatabasePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SettingsPageFrames\SettingsSecurityPage.xaml">
<Page Include="Views\SettingsPageFrames\SettingsSecurityPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SettingsPageFrames\SettingsWelcomePage.xaml">
<Page Include="Views\SettingsPageFrames\SettingsWelcomePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@@ -1,17 +0,0 @@
<Page
x:Class="ModernKeePass.Pages.MainPageFrames.DonatePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock x:Uid="DonateDesc" />
<RadioButton GroupName="DonateOptions" Content="1" />
<RadioButton GroupName="DonateOptions" Content="5" />
<RadioButton GroupName="DonateOptions" Content="10" />
<RadioButton GroupName="DonateOptions" Content="20" />
<Button x:Uid="DonateButton" />
</StackPanel>
</Page>

View File

@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages.MainPageFrames
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class DonatePage : Page
{
public DonatePage()
{
this.InitializeComponent();
}
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class WelcomePage : Page
{
public WelcomePage()
{
this.InitializeComponent();
}
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages.SettingsPageFrames
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SettingsWelcomePage : Page
{
public SettingsWelcomePage()
{
this.InitializeComponent();
}
}
}

View File

@@ -35,8 +35,12 @@ namespace ModernKeePass.Services
// Comment the following line in the release version of your app.
//_licenseInformation = CurrentAppSimulator.LicenseInformation;
#if DEBUG
var proxyFile = Package.Current.InstalledLocation.GetFileAsync("data\\WindowsStoreProxy.xml").GetAwaiter().GetResult();
CurrentAppSimulator.ReloadSimulatorAsync(proxyFile).GetAwaiter().GetResult();
try
{
var proxyFile = Package.Current.InstalledLocation.GetFileAsync("data\\WindowsStoreProxy.xml").GetAwaiter().GetResult();
CurrentAppSimulator.ReloadSimulatorAsync(proxyFile).GetAwaiter().GetResult();
}
catch { }
var listing = CurrentAppSimulator.LoadListingInformationAsync().GetAwaiter().GetResult();
#else
var listing = CurrentApp.LoadListingInformationAsync().GetAwaiter().GetResult();
@@ -44,7 +48,7 @@ namespace ModernKeePass.Services
Products = listing.ProductListings;
}
public async Task<PurchaseResult> Purchase(string addOn)
public async Task<int> Purchase(string addOn)
{
#if DEBUG
var purchaseResults = await CurrentAppSimulator.RequestProductPurchaseAsync(addOn);
@@ -55,7 +59,7 @@ namespace ModernKeePass.Services
{
case ProductPurchaseStatus.Succeeded:
GrantFeatureLocally(purchaseResults.TransactionId);
return await ReportFulfillmentAsync(purchaseResults.TransactionId, addOn);
return (int) await ReportFulfillmentAsync(purchaseResults.TransactionId, addOn);
case ProductPurchaseStatus.NotFulfilled:
// The purchase failed because we haven't confirmed fulfillment of a previous purchase.
// Fulfill it now.
@@ -63,11 +67,11 @@ namespace ModernKeePass.Services
{
GrantFeatureLocally(purchaseResults.TransactionId);
}
return await ReportFulfillmentAsync(purchaseResults.TransactionId, addOn);
return (int) await ReportFulfillmentAsync(purchaseResults.TransactionId, addOn);
case ProductPurchaseStatus.NotPurchased:
return PurchaseResult.NotPurchased;
return (int) PurchaseResult.NotPurchased;
case ProductPurchaseStatus.AlreadyPurchased:
return PurchaseResult.AlreadyPurchased;
return (int) PurchaseResult.AlreadyPurchased;
default:
throw new ArgumentOutOfRangeException();
}
@@ -75,11 +79,10 @@ namespace ModernKeePass.Services
private async Task<PurchaseResult> ReportFulfillmentAsync(Guid transactionId, string productName)
{
FulfillmentResult result;
#if DEBUG
result = await CurrentAppSimulator.ReportConsumableFulfillmentAsync(productName, transactionId);
var result = await CurrentAppSimulator.ReportConsumableFulfillmentAsync(productName, transactionId);
#else
result = await CurrentApp.ReportConsumableFulfillmentAsync(productName, transactionId);
var result = await CurrentApp.ReportConsumableFulfillmentAsync(productName, transactionId);
#endif
return (PurchaseResult) result;
}

View File

@@ -141,6 +141,48 @@
<data name="CompositeKeyUpdated" xml:space="preserve">
<value>Database composite key updated.</value>
</data>
<data name="DonateAlreadyPurchasedMessage" xml:space="preserve">
<value>Your product has already been purchased.</value>
</data>
<data name="DonateAlreadyPurchasedTitle" xml:space="preserve">
<value>Purchase</value>
</data>
<data name="DonateNothingToFulfillMessage" xml:space="preserve">
<value>No purchased product to fulfill</value>
</data>
<data name="DonateNothingToFulfillTitle" xml:space="preserve">
<value>Fulfillment</value>
</data>
<data name="DonateNotPurchasedMessage" xml:space="preserve">
<value>The purchase failed because we haven't confirmed fulfillment of a previous purchase.</value>
</data>
<data name="DonateNotPurchasedTitle" xml:space="preserve">
<value>Purchase</value>
</data>
<data name="DonatePurchasePendingMessage" xml:space="preserve">
<value>The purchase is pending so we cannot fulfill the product.</value>
</data>
<data name="DonatePurchasePendingTitle" xml:space="preserve">
<value>Purchase</value>
</data>
<data name="DonatePurchaseRevertedMessage" xml:space="preserve">
<value>Your purchase has been reverted.</value>
</data>
<data name="DonatePurchaseRevertedTitle" xml:space="preserve">
<value>Purchase</value>
</data>
<data name="DonateServerErrorMessage" xml:space="preserve">
<value>Impossible to contact the Windows Store, there was an error when fulfilling.</value>
</data>
<data name="DonateServerErrorTitle" xml:space="preserve">
<value>Error</value>
</data>
<data name="DonateSucceededMessage" xml:space="preserve">
<value>Your donation was successful.</value>
</data>
<data name="DonateSucceededTitle" xml:space="preserve">
<value>Thank you!</value>
</data>
<data name="EntityDeleteActionButton" xml:space="preserve">
<value>Delete</value>
</data>

View File

@@ -141,6 +141,48 @@
<data name="CompositeKeyUpdated" xml:space="preserve">
<value>Clé composite de la base de données mise à jour.</value>
</data>
<data name="DonateAlreadyPurchasedMessage" xml:space="preserve">
<value>Vous avez déjà acheté ce produit.</value>
</data>
<data name="DonateAlreadyPurchasedTitle" xml:space="preserve">
<value>Achat</value>
</data>
<data name="DonateNothingToFulfillMessage" xml:space="preserve">
<value>Il n'y a aucun produit acheté à valider.</value>
</data>
<data name="DonateNothingToFulfillTitle" xml:space="preserve">
<value>Validation</value>
</data>
<data name="DonateNotPurchasedMessage" xml:space="preserve">
<value>L'achat a échoué parce que nous n'avons pas pu valider un achat précédent.</value>
</data>
<data name="DonateNotPurchasedTitle" xml:space="preserve">
<value>Achat</value>
</data>
<data name="DonatePurchasePendingMessage" xml:space="preserve">
<value>Un achat est en cours donc nous ne pouvons le valider.</value>
</data>
<data name="DonatePurchasePendingTitle" xml:space="preserve">
<value>Achat</value>
</data>
<data name="DonatePurchaseRevertedMessage" xml:space="preserve">
<value>Votre achat a été annulé.</value>
</data>
<data name="DonatePurchaseRevertedTitle" xml:space="preserve">
<value>Achat</value>
</data>
<data name="DonateServerErrorMessage" xml:space="preserve">
<value>Impossible de contacter le Windows Store, l'achat n'a pas été réalisé.</value>
</data>
<data name="DonateServerErrorTitle" xml:space="preserve">
<value>Erreur</value>
</data>
<data name="DonateSucceededMessage" xml:space="preserve">
<value>Votre don a été enregistré.</value>
</data>
<data name="DonateSucceededTitle" xml:space="preserve">
<value>Merci!</value>
</data>
<data name="EntityDeleteActionButton" xml:space="preserve">
<value>Supprimer</value>
</data>

View 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);
}
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -6,7 +6,7 @@ using Windows.UI.Xaml.Navigation;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
namespace ModernKeePass.Pages.BasePages
namespace ModernKeePass.Views.BasePages
{
public class LayoutAwarePageBase: Page
{

View File

@@ -10,7 +10,7 @@
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:actions="using:ModernKeePass.Actions"
x:Name="PageRoot"
x:Class="ModernKeePass.Pages.EntryDetailPage"
x:Class="ModernKeePass.Views.EntryDetailPage"
mc:Ignorable="d">
<Page.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
@@ -380,7 +380,7 @@
<AppBarButton Icon="Home" x:Uid="AppBarHome">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.MainPage" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.MainPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
@@ -395,7 +395,7 @@
<AppBarButton Icon="Setting" x:Uid="AppBarSettings">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.SettingsPage" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.SettingsPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>

View File

@@ -8,7 +8,7 @@ using ModernKeePass.ViewModels;
// Pour en savoir plus sur le modèle d'élément Page Détail de l'élément, consultez la page http://go.microsoft.com/fwlink/?LinkId=234232
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// Page affichant les détails d'un élément au sein d'un groupe, offrant la possibilité de

View File

@@ -11,7 +11,7 @@
xmlns:controls="using:ModernKeePass.Controls"
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors"
x:Name="PageRoot"
x:Class="ModernKeePass.Pages.GroupDetailPage"
x:Class="ModernKeePass.Views.GroupDetailPage"
mc:Ignorable="d" >
<Page.Resources>
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
@@ -29,7 +29,7 @@
<AppBarButton Icon="Home" x:Uid="AppBarHome">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.MainPage" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.MainPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
@@ -44,7 +44,7 @@
<AppBarButton Icon="Setting" x:Uid="AppBarSettings">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.SettingsPage" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.SettingsPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>

View File

@@ -10,7 +10,7 @@ using ModernKeePass.ViewModels;
// The Group Detail Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234229
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// A page that displays an overview of a single group, including a preview of the items

View File

@@ -5,8 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:controls="using:ModernKeePass.Controls"
xmlns:basePages="using:ModernKeePass.Pages.BasePages"
x:Class="ModernKeePass.Pages.MainPage"
xmlns:basePages="using:ModernKeePass.Views.BasePages"
x:Class="ModernKeePass.Views.MainPage"
x:Name="PageRoot"
mc:Ignorable="d">
<Page.Resources>

View File

@@ -4,7 +4,7 @@ using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.

View File

@@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:ModernKeePass.ViewModels"
x:Class="ModernKeePass.Pages.AboutPage"
x:Class="ModernKeePass.Views.AboutPage"
mc:Ignorable="d">
<Page.DataContext>

View File

@@ -1,6 +1,6 @@
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.

View File

@@ -0,0 +1,30 @@
<Page
x:Class="ModernKeePass.Views.DonatePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:converters="using:ModernKeePass.Converters"
mc:Ignorable="d">
<Page.DataContext>
<viewModels:DonateVm />
</Page.DataContext>
<Page.Resources>
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
<CollectionViewSource
x:Name="DonateItemsSource"
Source="{Binding Donations}" />
</Page.Resources>
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock x:Uid="DonateDesc" Style="{StaticResource BodyTextBlockStyle}" />
<ItemsControl ItemsSource="{Binding Source={StaticResource DonateItemsSource}}" Margin="0,10,0,10">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="DonateOptions" Content="{Binding FormattedPrice}" Checked="ToggleButton_OnChecked" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button x:Uid="DonateButton" Click="ButtonBase_OnClick" IsEnabled="{Binding SelectedItem, Converter={StaticResource NullToBooleanConverter}}" />
</StackPanel>
</Page>

View File

@@ -0,0 +1,71 @@
using System;
using Windows.ApplicationModel.Store;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Common;
using ModernKeePass.Services;
using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class DonatePage
{
public DonateVm Model => DataContext as DonateVm;
public DonatePage()
{
InitializeComponent();
}
private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
{
var source = sender as RadioButton;
Model.SelectedItem = source?.DataContext as ProductListing;
}
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var resource = new ResourcesService();
try
{
var result = await Model.Purchase();
switch ((LicenseService.PurchaseResult)result)
{
case LicenseService.PurchaseResult.Succeeded:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonateSucceededTitle"), resource.GetResourceValue("DonateSucceededMessage"));
break;
case LicenseService.PurchaseResult.NothingToFulfill:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonateNothingToFulfillTitle"), resource.GetResourceValue("DonateNothingToFulfillMessage"));
break;
case LicenseService.PurchaseResult.PurchasePending:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonatePurchasePendingTitle"), resource.GetResourceValue("DonatePurchasePendingMessage"));
break;
case LicenseService.PurchaseResult.PurchaseReverted:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonatePurchaseRevertedTitle"), resource.GetResourceValue("DonatePurchaseRevertedMessage"));
break;
case LicenseService.PurchaseResult.ServerError:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonateServerErrorTitle"), resource.GetResourceValue("DonateServerErrorMessage"));
break;
case LicenseService.PurchaseResult.NotPurchased:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonateNotPurchasedTitle"), resource.GetResourceValue("DonateNotPurchasedMessage"));
break;
// Should never happen because these are consumables
case LicenseService.PurchaseResult.AlreadyPurchased:
MessageDialogHelper.ShowNotificationDialog(resource.GetResourceValue("DonateAlreadyPurchasedTitle"), resource.GetResourceValue("DonateAlreadyPurchasedMessage"));
break;
default:
throw new ArgumentOutOfRangeException();
}
}
catch (Exception exception)
{
MessageDialogHelper.ShowErrorDialog(exception);
}
}
}
}

View File

@@ -1,5 +1,5 @@
<Page
x:Class="ModernKeePass.Pages.NewDatabasePage"
x:Class="ModernKeePass.Views.NewDatabasePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -8,7 +8,8 @@
xmlns:converters="using:ModernKeePass.Converters"
xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:userControls="using:ModernKeePass.Views.UserControls"
mc:Ignorable="d">
<Page.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
@@ -23,15 +24,17 @@
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{Binding ShowPasswordBox, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Margin="25,0,25,0">
<TextBlock Text="{Binding Name}" />
<local:CompositeKeyUserControl CreateNew="True" ButtonLabel="Save" >
<userControls:CompositeKeyUserControl CreateNew="True" ButtonLabel="Save" >
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ValidationChecked">
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.GroupDetailPage" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</local:CompositeKeyUserControl>
</userControls:CompositeKeyUserControl>
</StackPanel>
</Border>
</StackPanel>
</Page>

View File

@@ -6,7 +6,7 @@ using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.

View File

@@ -6,8 +6,9 @@
xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:local="using:ModernKeePass.Controls"
xmlns:converters="using:ModernKeePass.Converters"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
x:Class="ModernKeePass.Pages.OpenDatabasePage"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:userControls="using:ModernKeePass.Views.UserControls"
x:Class="ModernKeePass.Views.OpenDatabasePage"
mc:Ignorable="d">
<Page.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
@@ -24,13 +25,13 @@
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{Binding ShowPasswordBox, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Margin="25,0,25,0">
<TextBlock Text="{Binding Name}" />
<local:CompositeKeyUserControl x:Uid="CompositeKeyOpenButton">
<userControls:CompositeKeyUserControl x:Uid="CompositeKeyOpenButton">
<interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="ValidationChecked">
<Core:NavigateToPageAction TargetPage="ModernKeePass.Pages.GroupDetailPage" />
<Core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
</Core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</local:CompositeKeyUserControl>
</userControls:CompositeKeyUserControl>
</StackPanel>
</Border>
</StackPanel>

View File

@@ -3,12 +3,11 @@ using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using ModernKeePass.Events;
using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.

View File

@@ -7,8 +7,9 @@
xmlns:local="using:ModernKeePass.Controls"
xmlns:converters="using:ModernKeePass.Converters"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
x:Class="ModernKeePass.Pages.RecentDatabasesPage"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:userControls="using:ModernKeePass.Views.UserControls"
x:Class="ModernKeePass.Views.RecentDatabasesPage"
mc:Ignorable="d">
<Page.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
@@ -50,17 +51,17 @@
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Name}" Padding="5,0,0,0" />
<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />
<local:CompositeKeyUserControl Grid.Row="2" x:Name="DatabaseUserControl" x:Uid="CompositeKeyOpenButton" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<userControls:CompositeKeyUserControl Grid.Row="2" x:Name="DatabaseUserControl" x:Uid="CompositeKeyOpenButton" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ValidationChecking">
<core:CallMethodAction TargetObject="{Binding}" MethodName="OpenDatabaseFile" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="ValidationChecked">
<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.GroupDetailPage" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</local:CompositeKeyUserControl>
</userControls:CompositeKeyUserControl>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>

View File

@@ -1,6 +1,6 @@
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.

View File

@@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:ModernKeePass.ViewModels"
x:Class="ModernKeePass.Pages.SaveDatabasePage"
x:Class="ModernKeePass.Views.SaveDatabasePage"
mc:Ignorable="d">
<Page.DataContext>
<viewModels:SaveVm/>

View File

@@ -8,7 +8,7 @@ using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
@@ -31,7 +31,7 @@ namespace ModernKeePass.Pages
private void SaveButton_OnClick(object sender, RoutedEventArgs e)
{
Model.Save();
_mainFrame.Navigate(typeof(MainPage));
_mainFrame.Navigate(typeof(Views.MainPage));
}
private async void SaveAsButton_OnClick(object sender, RoutedEventArgs e)
@@ -47,7 +47,7 @@ namespace ModernKeePass.Pages
if (file == null) return;
Model.Save(file);
_mainFrame.Navigate(typeof(MainPage));
_mainFrame.Navigate(typeof(Views.MainPage));
}
}
}

View File

@@ -1,5 +1,5 @@
<Page
x:Class="ModernKeePass.Pages.WelcomePage"
x:Class="ModernKeePass.Views.WelcomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -0,0 +1,15 @@
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class WelcomePage
{
public WelcomePage()
{
InitializeComponent();
}
}
}

View File

@@ -3,11 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:basePages="using:ModernKeePass.Pages.BasePages"
xmlns:controls="using:ModernKeePass.Controls"
xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:basePages="using:ModernKeePass.Views.BasePages"
x:Name="PageRoot"
x:Class="ModernKeePass.Pages.SettingsPage"
x:Class="ModernKeePass.Views.SettingsPage"
mc:Ignorable="d">
<Page.Resources>
<CollectionViewSource x:Name="MenuItemsSource" Source="{Binding MenuItems}" IsSourceGrouped="True" />

View File

@@ -1,10 +1,9 @@
using Windows.UI.Xaml.Controls;
using ModernKeePass.Pages.SettingsPageFrames;
using ModernKeePass.ViewModels;
// The Split Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234234
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// A page that displays a group title, a list of items within the group, and details for

View File

@@ -1,5 +1,5 @@
<Page
x:Class="ModernKeePass.Pages.SettingsDatabasePage"
x:Class="ModernKeePass.Views.SettingsDatabasePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -1,6 +1,6 @@
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.

View File

@@ -1,5 +1,5 @@
<Page
x:Class="ModernKeePass.Pages.SettingsPageFrames.SettingsNewDatabasePage"
x:Class="ModernKeePass.Views.SettingsNewDatabasePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -1,6 +1,6 @@
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Pages.SettingsPageFrames
namespace ModernKeePass.Views
{
/// <summary>
/// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.

View File

@@ -1,10 +1,11 @@
<Page
x:Class="ModernKeePass.Pages.SettingsSecurityPage"
x:Class="ModernKeePass.Views.SettingsSecurityPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ModernKeePass.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:userControls="using:ModernKeePass.Views.UserControls"
mc:Ignorable="d">
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@@ -14,6 +15,6 @@
<Run x:Uid="SettingsSecurityDesc2" FontWeight="SemiBold" />
<Run x:Uid="SettingsSecurityDesc3" />
</TextBlock>
<local:CompositeKeyUserControl Margin="0,20,0,0" UpdateKey="True" x:Uid="SettingsSecurityUpdateButton" ValidationChecked="CompositeKeyUserControl_OnValidationChecked" />
<userControls:CompositeKeyUserControl Margin="0,20,0,0" UpdateKey="True" x:Uid="SettingsSecurityUpdateButton" ValidationChecked="CompositeKeyUserControl_OnValidationChecked" />
</StackPanel>
</Page>

View File

@@ -2,9 +2,8 @@
using ModernKeePass.Common;
using ModernKeePass.Events;
using ModernKeePass.Services;
namespace ModernKeePass.Pages
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.

View File

@@ -1,5 +1,5 @@
<Page
x:Class="ModernKeePass.Pages.SettingsPageFrames.SettingsWelcomePage"
x:Class="ModernKeePass.Views.SettingsWelcomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -0,0 +1,15 @@
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SettingsWelcomePage
{
public SettingsWelcomePage()
{
InitializeComponent();
}
}
}

View File

@@ -1,5 +1,5 @@
<UserControl x:Name="UserControl"
x:Class="ModernKeePass.Controls.CompositeKeyUserControl"
x:Class="ModernKeePass.Views.UserControls.CompositeKeyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.Storage.Pickers;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
using ModernKeePass.Events;
@@ -13,7 +11,7 @@ using ModernKeePass.ViewModels;
// Pour en savoir plus sur le modèle d'élément Contrôle utilisateur, consultez la page http://go.microsoft.com/fwlink/?LinkId=234236
namespace ModernKeePass.Controls
namespace ModernKeePass.Views.UserControls
{
public sealed partial class CompositeKeyUserControl
{

View File

@@ -3,9 +3,8 @@ using System.Linq;
using Windows.ApplicationModel;
using Windows.Storage.AccessCache;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using ModernKeePass.Pages;
using ModernKeePass.Pages.SettingsPageFrames;
using ModernKeePass.ViewModels;
using ModernKeePass.Views;
using ModernKeePassApp.Test.Mock;
namespace ModernKeePassApp.Test
@@ -31,7 +30,7 @@ namespace ModernKeePassApp.Test
var mainVm = new MainVm(null, null, database, _resource, _recent);
Assert.AreEqual(1, mainVm.MainMenuItems.Count());
var firstGroup = mainVm.MainMenuItems.FirstOrDefault();
Assert.AreEqual(6, firstGroup.Count());
Assert.AreEqual(7, firstGroup.Count());
database.Status = 1;
mainVm = new MainVm(null, null, database, _resource, _recent);