protected void OnSuspending(object sender, SuspendingEventArgs @event) { // Validate. if (@event is null) { throw new ArgumentNullException(nameof(@event)); } // Delay var deferral = @event.SuspendingOperation.GetDeferral(); try { // Save state SaveState(); } catch (Exception error) { // Log error saving state then continue LocalErrorStore.Add(error); } finally { // End delay deferral.Complete(); } }
protected static void OnError(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs @event) { // Validate. if (@event is null) { throw new ArgumentNullException(nameof(@event)); } // Store error to send later LocalErrorStore.Add(@event.Exception); }
protected void OnResuming(object sender, object @event) { try { // Load state LoadState(); } catch (Exception error) { // Log error restoring state then create new model LocalErrorStore.Add(error); } }
/// <summary> /// Logs unhandled errors. /// </summary> protected static void OnError(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs @event) { // Store error to send later LocalErrorStore.Add(@event.Exception); }