FROM public sealed class SampleBackgroundTask : IBackgroundTask { public async void Run(IBackgroundTaskInstance taskInstance) { try{ var deferral = taskInstance.GetDeferral(); await DoSomethingAsync(); deferral.Complete(); } catch(..){ } }
To public sealed class SampleBackgroundTask : IBackgroundTask{ public async void Run(IBackgroundTaskInstance taskInstance){ try{ taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled); var deferral = taskInstance.GetDeferral(); await DoSomethingAsync(); } catch(..){…} finally{ deferral.Complete(); } } }
private void navigationHelper_SaveState( object sender, SaveStateEventArgs e) { if (this.itemsViewSource.View != null) { var selectedItem = (Data.SampleDataItem)this.itemsViewSource.View.CurrentItem; if (selectedItem != null) e.PageState["SelectedItem"] = selectedItem.UniqueId; int[] a5 = new int[5]; e.PageState["SomeData"] = a5; }