Suspending-Ereignis nicht Erhöhung mit WinRT

Ich habe ein problem mit suspending-Ereignis auf Windows Phone 8.1 mit WinRT, es wird nicht ausgelöst. Ich weiß nicht, warum. Das ist mein code:

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

    Suspending += OnSuspending;
#if DEBUG
    this.displayRequest = new DisplayRequest();
#endif
}

///<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();
    deferral.Complete();
}

Ich einen Haltepunkt auf die Zeile var deferral = e.SuspendingOperation.GetDeferral(); und Debuggen mit Visual Studio. Dann drückte ich die start-Taste auf meinem Handy und lief in eine andere app und wartete etwa 10 Sekunden. OnSuspending wird nicht ausgeführt.

Irgendwelche Ideen?

InformationsquelleAutor UltimaWeapon | 2014-06-08
Schreibe einen Kommentar