本文整理匯總了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();
}
示例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();
}
示例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();
}
示例4: OnSuspending
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
Debug.WriteLine("SuspensionManager.SaveAsync()");
await SuspensionManager.SaveAsync();
deferral.Complete();
}
示例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();
}
}
示例6: Application_Suspending
private async void Application_Suspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
// cleanupCamera
await cleanupCameraAsync();
deferral.Complete();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}