fix notification activation

This commit is contained in:
2020-05-02 20:07:19 +03:00
parent ce57bf069c
commit c4c904ddb4
2 changed files with 28 additions and 5 deletions

View File

@@ -39,8 +39,7 @@ namespace PomoTime
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
private void OnLaunchedOrActivated(IActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
@@ -53,7 +52,7 @@ namespace PomoTime
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated
|| e.PreviousExecutionState == ApplicationExecutionState.ClosedByUser)
{
ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
@@ -71,7 +70,7 @@ namespace PomoTime
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
if (e is LaunchActivatedEventArgs && ((LaunchActivatedEventArgs)e).PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
@@ -83,6 +82,30 @@ namespace PomoTime
// Ensure the current window is active
Window.Current.Activate();
}
if (e is ToastNotificationActivatedEventArgs)
{
ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
if (localSettings.Values["MinutesLeft"] != null)
{
RunningState.MinutesLeft = (int)localSettings.Values["MinutesLeft"];
RunningState.SecondsLeft = (int)localSettings.Values["SecondsLeft"];
RunningState.IsRunning = (bool)localSettings.Values["IsRunning"];
RunningState.PreviousShortBreaks = (int)localSettings.Values["PreviousShortBreaks"];
RunningState.CurrentPeriod = (Period)localSettings.Values["CurrentPeriod"];
}
rootFrame.Navigate(typeof(MainPage), RunningState);
Window.Current.Activate();
}
}
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
OnLaunchedOrActivated(e);
}
protected override void OnActivated(IActivatedEventArgs e)
{
OnLaunchedOrActivated(e);
}
/// <summary>

View File

@@ -9,7 +9,7 @@
<Identity
Name="44844StepanUsatyuk.PomoTime"
Publisher="CN=D7EE55C2-4D4B-40F8-8EE5-CC4CEBCE2133"
Version="1.0.2.0" />
Version="1.0.3.0" />
<mp:PhoneIdentity PhoneProductId="4d8bddac-8ab7-4c19-b3c7-7b5a27b87594" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>