コード例 #1
0
 public override void OnActivated(string arguments, NotificationUserInputCollection userInputCollection, string appUserModelId)
 {
     Logging.DefaultLogger.Info($"Toast notification was activated with arguments: '{arguments}'. Source app:{appUserModelId}");
     ToastActions.ParseToastActionArguments(arguments).Match(func =>
     {
         func().Match(unit => Unit.Default, exception =>
         {
             Logging.DefaultLogger.Error($"Failed to execute action registered to action arguments: '{arguments}'. {exception.ToExceptionMessage()}");
             return(Unit.Default);
         });
     }, () =>
     {
         Logging.DefaultLogger.Warn($"No action registered to action arguments: '{arguments}'.");
     });
     ToastGroups.ParseToastGroupArguments(arguments).Match(group =>
     {
         Logging.DefaultLogger.Info($"Requesting unregistration of notification group '{group}''");
         Messenger.Default.Send(new UnRegisterToastNotificationMessage(group));
     }, () =>
     {
         Logging.DefaultLogger.Warn("Did not send unregister request due to missing toast notification group name in toast activation arguments.");
     });
 }
コード例 #2
0
 /// <summary>
 /// This method will be called when the user clicks on a foreground or background activation on a toast. Parent app must implement this method.
 /// </summary>
 /// <param name="arguments">The arguments from the original notification. This is either the launch argument if the user clicked the body of your toast, or the arguments from a button on your toast.</param>
 /// <param name="userInputCollection">Text and selection values that the user entered in your toast.</param>
 /// <param name="appUserModelId">Your AUMID.</param>
 public abstract void OnActivated(string arguments, NotificationUserInputCollection userInputCollection, string appUserModelId);