Example #1
0
 private async static void Task_Completed(BackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs args)
 {
     await CallUIThreadHelper.CallOnUiThreadAsync(() => new ToastContentBuilder().AddArgument("action", "viewConversation")
                                                  .AddArgument("conversationId", 9813)
                                                  .AddText("You have no internet!")
                                                  .AddText("App may not operate normally.")
                                                  .Show());
 }
Example #2
0
 /// <summary>
 /// Unregister current task from background execution.
 /// </summary>
 private static async void Stop(string taskName)
 {
     await CallUIThreadHelper.CallOnUiThreadAsync(() =>
     {
         var taskList = BackgroundTaskRegistration.AllTasks.Values;
         var task     = taskList.FirstOrDefault(i => i.Name == taskName);
         if (task != null)
         {
             task.Unregister(true);
         }
     });
 }