當前位置: 首頁>>代碼示例>>C#>>正文


C# ApplicationModel.SuspendingEventArgs類代碼示例

本文整理匯總了C#中Windows.ApplicationModel.SuspendingEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# SuspendingEventArgs類的具體用法?C# SuspendingEventArgs怎麽用?C# SuspendingEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SuspendingEventArgs類屬於Windows.ApplicationModel命名空間,在下文中一共展示了SuspendingEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnSuspending

        /// <summary>
        /// 在將要掛起應用程序執行時調用。在不知道應用程序
        /// 將被終止還是恢複的情況下保存應用程序狀態,
        /// 並讓內存內容保持不變。
        /// </summary>
        /// <param name="sender">掛起的請求的源。</param>
        /// <param name="e">有關掛起的請求的詳細信息。</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
    ApplicationData.Current.LocalSettings.Values["suspendedDateTime"] = DateTime.Now.ToString();
    var deferral = e.SuspendingOperation.GetDeferral();
    //TODO: 保存應用程序狀態並停止任何後台活動
    deferral.Complete();
}
開發者ID:BeyondVincent,項目名稱:WindowsStoreAppCode,代碼行數:14,代碼來源:App.xaml.cs

示例2: OnSuspending

 /// <summary>
 /// 在將要掛起應用程序執行時調用。在不知道應用程序
 /// 將被終止還是恢複的情況下保存應用程序狀態,
 /// 並讓內存內容保持不變。
 /// </summary>
 /// <param name="sender">掛起的請求的源。</param>
 /// <param name="e">有關掛起的請求的詳細信息。</param>
 private void OnSuspending(object sender, SuspendingEventArgs e)
 {
     SearchPane.GetForCurrentView().ShowOnKeyboardInput = false;
     var deferral = e.SuspendingOperation.GetDeferral();
     //TODO: 保存應用程序狀態並停止任何後台活動
     deferral.Complete();
 }
開發者ID:BeyondVincent,項目名稱:WindowsStoreAppCode,代碼行數:14,代碼來源:App.xaml.cs

示例3: OnSuspending

 /// <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 static async void OnSuspending(object sender, SuspendingEventArgs e)
 {
     var deferral = e.SuspendingOperation.GetDeferral();
     await SuspensionManager.SaveAsync();
     await AutoAnalytics.StopAsync();
     deferral.Complete();
 }
開發者ID:bayramucuncu,項目名稱:CSharpAnalytics,代碼行數:14,代碼來源:App.xaml.cs

示例4: OnSuspending

 private async void OnSuspending(object sender, SuspendingEventArgs e)
 {
     var deferral = e.SuspendingOperation.GetDeferral();
     Debug.WriteLine("SuspensionManager.SaveAsync()");
     await SuspensionManager.SaveAsync();
     deferral.Complete();
 }
開發者ID:yamac,項目名稱:windows-demos,代碼行數:7,代碼來源:App.xaml.cs

示例5: SaveDataToPersistedState

        /// <summary>
        /// When the application is about to enter a suspended state, save the user edited properties text.
        /// This method does not use the SuspensionManager helper class (defined in SuspensionManager.cs).
        /// </summary>
        private void SaveDataToPersistedState(object sender, SuspendingEventArgs args)
        {
            // Only save state if we have valid data.
            if (m_fileToken != null)
            {
                // Requesting a deferral prevents the application from being immediately suspended.
                SuspendingDeferral deferral = args.SuspendingOperation.GetDeferral();

                // LocalSettings does not support overwriting existing items, so first clear the collection.
                ResetPersistedState();

                m_localSettings.Add("scenario2FileToken", m_fileToken);
                m_localSettings.Add("scenario2Width", m_displayWidthNonScaled);
                m_localSettings.Add("scenario2Height", m_displayHeightNonScaled);
                m_localSettings.Add("scenario2Scale", m_scaleFactor);
                m_localSettings.Add("scenario2UserRotation",
                    Helpers.ConvertToExifOrientationFlag(m_userRotation)
                    );

                m_localSettings.Add("scenario2ExifOrientation",
                    Helpers.ConvertToExifOrientationFlag(m_exifOrientation)
                    );

                m_localSettings.Add("scenario2DisableExif", m_disableExifOrientation);

                deferral.Complete();
            }
        }
開發者ID:C-C-D-I,項目名稱:Windows-universal-samples,代碼行數:32,代碼來源:Scenario2.xaml.cs

示例6: Application_Suspending

 private async void Application_Suspending(object sender, SuspendingEventArgs e)
 {
     var deferral = e.SuspendingOperation.GetDeferral();
     // cleanupCamera
     await cleanupCameraAsync();
     deferral.Complete();
 }
開發者ID:agangal,項目名稱:ARTest,代碼行數:7,代碼來源:VideoView.xaml.cs

示例7: OnSuspending

 protected override async void OnSuspending(object sender, SuspendingEventArgs e)
 {
     base.OnSuspending(sender, e);
     var deferal = e.SuspendingOperation.GetDeferral();
     await SuspensionManager.SaveAsync();
     deferal.Complete();
 }
開發者ID:ibebbs,項目名稱:CaliburnDemoWinRT,代碼行數:7,代碼來源:App.xaml.cs

示例8: App_Suspending

 /// <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 App_Suspending(object sender, SuspendingEventArgs e)
 {
     var deferral = e.SuspendingOperation.GetDeferral();
     // Optional: Save application state and stop any background activity
     ShowToast("Suspending");
     deferral.Complete();
 }
開發者ID:jigartailor1984,項目名稱:UWPAppSamples,代碼行數:14,代碼來源:BackgroundApp.cs

示例9: OnSuspending

 /// <summary>
 /// 在將要掛起應用程序執行時調用。在不知道應用程序
 /// 將被終止還是恢複的情況下保存應用程序狀態,
 /// 並讓內存內容保持不變。
 /// </summary>
 /// <param name="sender">掛起的請求的源。</param>
 /// <param name="e">有關掛起的請求的詳細信息。</param>
 private async void OnSuspending(object sender, SuspendingEventArgs e)
 {
     var deferral = e.SuspendingOperation.GetDeferral();
     //TODO: 保存應用程序狀態並停止任何後台活動
     await HelloWorld.Common.SuspensionManager.SaveAsync();
     deferral.Complete();
 }
開發者ID:elff1,項目名稱:HelloWin8App,代碼行數:14,代碼來源:App.xaml.cs

示例10: OnSuspending

		/// <summary>
		/// Invoked when application execution is being suspended.  Application state is saved
		/// without knowing whether the application will be terminated or resumed with the content
		/// 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 async void OnSuspending(object sender, SuspendingEventArgs e)
		{
			var deferral = e.SuspendingOperation.GetDeferral();
			await AudioController.Default.SerializeAsync();
			await TuneOut.Common.SuspensionManager.SaveAsync();
			deferral.Complete();
		}
開發者ID:sdao,項目名稱:TuneOut,代碼行數:14,代碼來源:App.xaml.cs

示例11: OnSuspending

        /// <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();

            // TODO: Save application state and stop any background activity
            deferral.Complete();
        }
開發者ID:RestfulMonad,項目名稱:MetroMetro,代碼行數:14,代碼來源:App.xaml.cs

示例12: SaveDataToPersistedState

        /// <summary>
        /// When the application is about to enter a suspended state, save the user edited properties text.
        /// This method does not use the SuspensionManager helper class (defined in SuspensionManager.cs).
        /// </summary>
        private void SaveDataToPersistedState(object sender, SuspendingEventArgs args)
        {
            // Only save state if we have valid data.
            if (m_fileToken != null)
            {
                // Requesting a deferral prevents the application from being immediately suspended.
                SuspendingDeferral deferral = args.SuspendingOperation.GetDeferral();

                // LocalSettings does not support overwriting existing items, so first clear the collection.
                ResetPersistedState();

                m_localSettings.Add("scenario1Title", TitleTextbox.Text);
                m_localSettings.Add("scenario1Keywords", KeywordsTextbox.Text);
                m_localSettings.Add("scenario1DateTaken", DateTakenTextblock.Text);
                m_localSettings.Add("scenario1Make", MakeTextblock.Text);
                m_localSettings.Add("scenario1Model", ModelTextblock.Text);
                m_localSettings.Add("scenario1Orientation", OrientationTextblock.Text);
                m_localSettings.Add("scenario1LatDeg", LatDegTextbox.Text);
                m_localSettings.Add("scenario1LatMin", LatMinTextbox.Text);
                m_localSettings.Add("scenario1LatSec", LatSecTextbox.Text);
                m_localSettings.Add("scenario1LatRef", LatRefTextbox.Text);
                m_localSettings.Add("scenario1LongDeg", LongDegTextbox.Text);
                m_localSettings.Add("scenario1LongMin", LongMinTextbox.Text);
                m_localSettings.Add("scenario1LongSec", LongSecTextbox.Text);
                m_localSettings.Add("scenario1LongRef", LongRefTextbox.Text);
                m_localSettings.Add("scenario1Exposure", ExposureTextblock.Text);
                m_localSettings.Add("scenario1FNumber", FNumberTextblock.Text);
                m_localSettings.Add("scenario1FileToken", m_fileToken);

                deferral.Complete();
            }
        }
開發者ID:mbin,項目名稱:Win81App,代碼行數:36,代碼來源:ImagingProperties.xaml.cs

示例13: OnSuspending

 private async void OnSuspending(object sender, SuspendingEventArgs e)
 {
   var deferral = e.SuspendingOperation.GetDeferral();
   KarliCards.Gui.Common.SuspensionManager.KnownTypes.Add(typeof(GameViewModel));
   await KarliCards.Gui.Common.SuspensionManager.SaveAsync();
   deferral.Complete();
 }
開發者ID:ktjones,項目名稱:BVCS2012,代碼行數:7,代碼來源:App.xaml.cs

示例14: OnSuspendingAsync

 protected async override Task OnSuspendingAsync(object s, SuspendingEventArgs e)
 {
     // Dirty hack until I can figure out how to fix OnNavigatedFrom behaviour
     var deferral = e.SuspendingOperation.GetDeferral();
     // Give enough time for the file storage to work when app is suspending
     await Task.Delay(500);
     deferral.Complete();
 }
開發者ID:MuffPotter,項目名稱:201505-MVA,代碼行數:8,代碼來源:App.xaml.cs

示例15: OnSuspendingAsync

        protected async override Task OnSuspendingAsync(object s, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            // TODO Add any logic required on app suspension
            //await Task.Delay(500);

            deferral.Complete();
        }
開發者ID:Ronacs,項目名稱:WinDevCamp,代碼行數:8,代碼來源:App.xaml.cs


注:本文中的Windows.ApplicationModel.SuspendingEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。