WIP toast notifications

WIP layout and color changes
This commit is contained in:
2017-10-17 18:46:05 +02:00
committed by BONNEVILLE Geoffroy
parent 19008cdad2
commit 01ed1bc9c1
10 changed files with 211 additions and 28 deletions

View File

@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Search;
using Windows.Foundation;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using Microsoft.QueryStringDotNET;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
using ModernKeePass.ViewModels;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
@@ -20,6 +21,7 @@ namespace ModernKeePass
sealed partial class App : Application
{
public DatabaseHelper Database { get; set; } = new DatabaseHelper();
public Queue<IPwEntity> PendingDeleteQueue = new Queue<IPwEntity>();
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
@@ -38,6 +40,16 @@ namespace ModernKeePass
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
OnLaunchOrActivated(e);
}
protected override void OnActivated(IActivatedEventArgs args)
{
OnLaunchOrActivated(args);
}
private void OnLaunchOrActivated(IActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
@@ -68,12 +80,34 @@ namespace ModernKeePass
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
if (e is LaunchActivatedEventArgs)
{
// 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(MainPage), e.Arguments);
var lauchActivatedEventArgs = e as LaunchActivatedEventArgs;
if (rootFrame.Content == null)
{
// 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(MainPage), lauchActivatedEventArgs.Arguments);
}
}
//if (e is ToastNotificationActivatedEventArgs)
else
{
/*var toastActivationArgs = e as ToastNotificationActivatedEventArgs;
// Parse the query string (using QueryString.NET)
QueryString args = QueryString.Parse(toastActivationArgs.Argument);
// See what action is being requested
switch (args["action"])
{
}*/
var entity = PendingDeleteQueue.Dequeue();
if (entity is GroupVm)
{
entity.ParentGroup.Groups.Add(entity as GroupVm);
}
}
// Ensure the current window is active
Window.Current.Activate();
@@ -100,7 +134,7 @@ namespace ModernKeePass
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
//Database.Save();
Database.Save();
deferral.Complete();
}