Beispiel #1
0
 public PrismApplicationBase()
 {
     InternalInitialize();
     (this as IPrismApplicationEvents).WindowCreated += (s, e) =>
     {
         GestureService.SetupForCurrentView(e.Window.CoreWindow);
     };
     base.Suspending += async(s, e) =>
     {
         if (ApplicationData.Current.LocalSettings.Values.ContainsKey("Suspend_Data"))
         {
             ApplicationData.Current.LocalSettings.Values.Remove("Suspend_Data");
         }
         ApplicationData.Current.LocalSettings.Values.Add("Suspend_Data", DateTime.Now.ToString());
         var deferral = e.SuspendingOperation.GetDeferral();
         try
         {
             OnSuspending();
             await OnSuspendingAsync();
         }
         finally
         {
             deferral.Complete();
         }
     };
     base.Resuming += async(s, e) =>
     {
         await InternalStartAsync(new StartArgs(ResumeArgs.Create(ApplicationExecutionState.Suspended), StartKinds.Resume));
     };
 }
 private static void TestResuming(StartArgs startArgs)
 {
     if (startArgs.Arguments is ILaunchActivatedEventArgs e && e.PreviousExecutionState == ApplicationExecutionState.Terminated)
     {
         if (ApplicationData.Current.LocalSettings.Values.ContainsKey("Suspend_Data"))
         {
             startArgs.Arguments = ResumeArgs.Create(ApplicationExecutionState.Terminated);
             startArgs.StartKind = StartKinds.Resume;
         }
     }
 }