public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId) { Application.Current.Dispatcher.Invoke(delegate { // Tapping on the top-level header launches with empty args if (invokedArgs.Length == 0) { // Perform a normal launch if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } return; } // Parse the query string (using NuGet package QueryString.NET) var args = QueryString.Parse(invokedArgs); if (args["appidrevision"].Equals("close")) { if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } return; } else if (args["appidrevision"].Equals("reboot")) { switch (args["action"]) { case "restart": Globals.Log.Information("User pressed Toast button 'Restart now' (Restart)"); try { var conf = Globals.Settings.RestartConfig; Process.Start(new ProcessStartInfo { FileName = _userApp, Arguments = $"/ShowRestartWindow", }); } catch (Exception ex) { Globals.Log.Error(ex.Message); } if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; case "schedulerestart": Globals.Log.Information("User pressed Toast button 'Schedule' (Restart)"); OpenWindowIfNeeded(); Globals.MainWnd.RebootScheduler(); break; case "remind": Globals.Log.Information("User pressed Toast button 'Remind me later' (Restart)"); if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; } } else if (args["appidrevision"].Equals("sup")) { switch (args["action"]) { // Open the image case "install": Globals.Log.Information("User pressed Toast button 'Install' (Sup)"); var jsonSup = SqlCe.GetSupData("STD"); var sups = JsonConvert.DeserializeObject <List <Update> >(jsonSup); //var sups = CcmUtils.GetUpdates(); if (sups.Count() > 0) { CustomToasts.NotifySupInstallationStart(); CcmUtils.ExecuteInstallUpdates(true); } if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; // Background: Quick reply to the conversation case "schedule": Globals.Log.Information("User pressed Toast button 'Schedule' (Sup)"); // Make sure we have a window open and in foreground OpenWindowIfNeeded(); if (Globals.Settings.ToastNotifyNewSupSettings.OpenWizardTabOnSchedule) { Globals.MainWnd.OpenWizadTab(); } else { Globals.MainWnd.AddSupScheduler(); } break; case "postpone": Globals.Log.Information("User pressed Toast button 'Postpone' (Sup)"); // Make sure we have a window open and in foreground //OpenWindowIfNeeded(); // And send this message //(Application.Current.Windows[0] as MainWindow).ShowConversation("postpone" + args["appidrevision"]); //Application.Current.Shutdown(); if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; default: if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; } } else { // See what action is being requested switch (args["action"]) { // Open the image /* * case "install": * Globals.Log.Information("User pressed Toast button 'Install' (App)"); * * var appdata = args["appidrevision"].Split(';'); * var app = CcmUtils.GetSpecificApp(new ScheduledObject { ObjectId = appdata[0], Revision = appdata[1] }); * * if (app != null) * { * CustomToasts.NotifyAppInstallationStart(app); * CcmUtils.InstallApplication(app); * } * * if (Application.Current.Windows.Count == 0) * { * Application.Current.Shutdown(); * } * * break; */ // Background: Quick reply to the conversation case "schedule": Globals.Log.Information("User pressed Toast button 'Schedule' (App)"); // Make sure we have a window open and in foreground OpenWindowIfNeeded(); if (Globals.Settings.ToastNotifyNewApplicationSettings.OpenWizardTabOnSchedule) { Globals.MainWnd.OpenWizadTab(); } else { Globals.MainWnd.AddAppScheduler(); } break; case "scheduleipu": Globals.Log.Information("User pressed Toast button 'Schedule' (IpuApp)"); // Make sure we have a window open and in foreground OpenWindowIfNeeded(); Globals.MainWnd.AddIpuAppScheduler(); break; case "postpone": Globals.Log.Information("User pressed Toast button 'Postpone' (App)"); if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; default: if (Application.Current.Windows.Count == 0) { Application.Current.Shutdown(); } break; } } }); }