本文整理汇总了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();
}