v1.0.11.0 fix an issue when timer's state might not be restored on launch

This commit is contained in:
2020-06-23 11:23:22 +03:00
parent b5d18f6f6a
commit 3f075ed69e
2 changed files with 12 additions and 22 deletions

View File

@@ -44,6 +44,16 @@ namespace PomoTime
{
Frame rootFrame = Window.Current.Content as Frame;
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"];
}
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
@@ -55,17 +65,7 @@ namespace PomoTime
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated
|| e.PreviousExecutionState == ApplicationExecutionState.ClosedByUser)
{
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"];
}
}
{}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
@@ -87,16 +87,6 @@ namespace PomoTime
{
var toastActivationArgs = e as 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"];
}
QueryString args = QueryString.Parse(toastActivationArgs.Argument);
if (args.Contains("action"))
{

View File

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