예제 #1
0
        /// <summary>
        /// Initializes the singleton application object. This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += this.OnSuspending;

#if WINDOWS_PHONE_APP
            ContinuationManager = new ContinuationManager();
#endif
        }
예제 #2
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

#if WINDOWS_PHONE_APP
            ContinuationManager.MarkAsStale();
#endif

            // TODO: Save application state and stop any background activity
            deferral.Complete();
        }
예제 #3
0
        protected override void OnActivated(IActivatedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("App.OnActivated(): " + e.PreviousExecutionState.ToString());

            // Check if this is a continuation
            var continuationEventArgs = e as IContinuationActivatedEventArgs;

            if (continuationEventArgs != null)
            {
                ContinuationManager.Continue(continuationEventArgs);
            }

            Window.Current.Activate();
        }