///
/// 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().
///
public App()
{
InitializeComponent();
Suspending += OnSuspending;
#if DEBUG
this.displayRequest = new DisplayRequest();
#endif
}
///
/// 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.
///
///
/// The source of the suspend request.
///
///
/// Details about the suspend request.
///
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
deferral.Complete();
}
< /code>
Я установил точку останова на линии var deferral = e.suspendingoperation.getdeferral (); < /code> и отладка с визуальной студией. Затем я нажал кнопку «Пуск» на своем телефоне, запустил другое приложение и подождал около 10 секунд. Onsuspending
У меня проблема с приостановкой события на Windows Phone 8.1, используя Winrt, он не стреляет. Я не знаю почему. Это мой код: < /p>
[code]/// /// 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(). /// public App() { InitializeComponent();
/// /// 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. /// /// /// The source of the suspend request. /// /// /// Details about the suspend request. /// private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); deferral.Complete(); } < /code>
Я установил точку останова на линии var deferral = e.suspendingoperation.getdeferral (); < /code> и отладка с визуальной студией. Затем я нажал кнопку «Пуск» на своем телефоне, запустил другое приложение и подождал около 10 секунд. Onsuspending [/code] не работает. < /p>