Ejemplo n.º 1
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            Log.Information("Activator activated with {Args}", invokedArgs);
            // Clear all toasts
            try
            {
                DesktopNotificationManagerCompat.History.Clear();
            }
            catch (Exception)
            {
                // Ignore errors (when notification service is not available)
            }
            switch (invokedArgs)
            {
            case UpdateAllAction:
                Choco.UpdateAllPackages();
                Environment.Exit(0);
                break;

            case UpdateAction:
            default:
                App.ShowUpdateDialog();
                break;
            }
        }
Ejemplo n.º 2
0
        private void HandleNotificationActivated(string invokedArgs, NotificationUserInput userInput)
        {
            var args = new Dictionary <string, string>();

            foreach (var arg in invokedArgs.Split('&'))
            {
                var parts = arg.Split(new [] { '=' }, 2);
                var key   = Uri.UnescapeDataString(parts[0]);
                var value = Uri.UnescapeDataString(parts[1]);
                args[key] = value;
            }

            if (!args.TryGetValue("tag", out var tag))
            {
                return;
            }
            if (!_notifications.TryGetValue(tag, out var notification))
            {
                return;
            }

            if (args.TryGetValue("click", out var clickIndexStr))
            {
                notification.ActivateAction(int.Parse(clickIndexStr), null);
            }
            else if (args.TryGetValue("text-input", out var inputIndexStr))
            {
                var inputIndex = int.Parse(inputIndexStr);
                var inputText  = userInput["input" + inputIndex];
                notification.ActivateAction(inputIndex, inputText);
            }
        }
Ejemplo n.º 3
0
        public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            if (arguments?.Length == 0)
            {
                WriteLine($"The user clicked on the toast.");
            }
            else
            {
                WriteLine($"The user clicked on the toast. {arguments}");
            }

            var inputs = string.Empty;

            if (userInput?.Data != null)
            {
                foreach (var input in userInput)
                {
                    if (!string.IsNullOrEmpty(inputs))
                    {
                        inputs += "&";
                    }
                    inputs += $"{input.Key}={input.Value}";
                }
            }

            if (inputs != string.Empty)
            {
                WriteLine($"The user entered the following input values: {inputs}");
            }

            Exit(0);
        }
Ejemplo n.º 4
0
        public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                if (arguments.Length == 0)
                {
                    OpenWindowIfNeeded();
                    return;
                }

                switch (arguments)
                {
                case "change":
                    mw.arduinoPort.Close();
                    mw.arduinoPort = new SerialPort(userInput["portBox"], 9600);
                    mw.arduinoPort.Open();
                    break;

                case "retry":
                    mw.arduinoPort.Open();
                    break;

                case "stop":
                    Environment.Exit(0);
                    break;

                default:
                    //
                    break;
                }
            });
        }
Ejemplo n.º 5
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            // dummy activator
            if (Toasts.TimerAction.WithArgs.ContainsKey(invokedArgs))
            {
                var timerAction = Toasts.TimerAction.WithArgs[invokedArgs];

                PomodoroEngine.pomodoroEngine.StartTimer(timerAction.IntervalType);
            }
        }
 public override async void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
 {
     await Application.Current.Dispatcher.InvokeAsync(async() =>
     {
         var app    = Application.Current as App;
         var config = SimpleIoc.Default.GetInstance <IConfiguration>();
         config[ToastNotificationActivationHandler.ActivationArguments] = arguments;
         await app.StartAsync();
     });
 }
        public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            var uri       = new Uri(arguments, UriKind.Absolute);
            var startInfo = new ProcessStartInfo(uri.ToString())
            {
                UseShellExecute = true,
            };

            Process.Start(startInfo);
        }
Ejemplo n.º 8
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                OpenWindowIfNeeded();

                // ログ表示
                MainWindow.mw.AddLog("OnActivated()実行しました");
                MainWindow.mw.AddLog(invokedArgs);
            });
        }
Ejemplo n.º 9
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            // TODO: Handle activation

            Application.Current.Dispatcher.Invoke(() =>
            {
                // Make sure we have a window open and in foreground
                OpenWindowIfNeeded();
                // And then show the image
                (App.Current.Windows[0] as MainWindow).SetMessage(invokedArgs);
            });
        }
 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
             OpenWindowIfNeeded();
             return;
         }
     });
 }
Ejemplo n.º 11
0
        public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                // Tapping on the top-level header launches with empty args
                if (arguments.Length == 0)
                {
                    // Perform a normal launch
                    OpenWindowIfNeeded();
                    return;
                }

                // Parse the query string (using NuGet package QueryString.NET)
                QueryString args = QueryString.Parse(arguments);

                // See what action is being requested
                switch (args["action"])
                {
                // Open the image
                case "viewImage":

                    // The URL retrieved from the toast args
                    string imageUrl = args["imageUrl"];

                    // Make sure we have a window open and in foreground
                    OpenWindowIfNeeded();

                    // And then show the image
                    //(App.Current.Windows[0] as MainWindow).ShowImage(imageUrl);

                    break;

                // Background: Quick reply to the conversation
                case "reply":

                    // Get the response the user typed
                    string msg = userInput["tbReply"];

                    // And send this message
                    //SendMessage(msg);

                    // If there's no windows open, exit the app
                    if (App.Current.Windows.Count == 0)
                    {
                        Application.Current.Shutdown();
                    }

                    break;
                }
            });
        }
        public override async void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            await Application.Current.Dispatcher.InvokeAsync(async() =>
            {
                var app    = Application.Current as App;
                var config = app.Resolve <IConfiguration>();
                // Store ToastNotification arguments in configuration, so you can use them from any point in the app
                config[App.ToastNotificationActivationArguments] = arguments;

                Application.Current.MainWindow.Show();
                App.Current.MainWindow.Activate();
                if (App.Current.MainWindow.WindowState == WindowState.Minimized)
                {
                    App.Current.MainWindow.WindowState = WindowState.Normal;
                }
                await Task.CompletedTask;
            });
        }
Ejemplo n.º 13
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            if (invokedArgs.Length == 0)
            {
                SynchronizationContext.Current.Send(_ =>
                {
                    OpenWindowIfNeeded();
                }, null);

                return;
            }

            Dictionary <string, string> args = new Dictionary <string, string>();

            foreach (var arg in invokedArgs.Split('&', ';'))
            {
                var sep = arg.IndexOf('=');

                if (sep == -1)
                {
                    args.Add(UrlDecode(arg), null); //Empty argument; we assign a key with a null value
                }
                else
                {
                    args.Add(UrlDecode(arg.Substring(0, sep)), UrlDecode(arg.Substring(sep + 1)));
                }
            }

            //Ensure we have an open form before running the test
            SynchronizationContext.Current.Send(_ =>
            {
                OpenWindowIfNeeded();
            }, null);

            //Test
            var MainForm = Application.OpenForms["Main"] as Main;

            MainForm.BeginInvoke(new Action(() =>
            {
                MessageBox.Show("Hooray! it worked.");
            }));
        }
Ejemplo n.º 14
0
            public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
            {
                // Tapping on the top-level header launches with empty args
                if (arguments.Length == 0)
                {
                    OpenWindowIfNeeded();
                    return;
                }

                // Parse the query string (using NuGet package QueryString.NET)
                QueryString args = QueryString.Parse(WebUtility.UrlDecode(arguments));

                string url = args["id"];

                // See what action is being requested
                switch ((BaseActionType)(int.Parse(args["action"])))
                {
                case BaseActionType.OPEN_APP:
                    OpenWindowIfNeeded();
                    break;

                case BaseActionType.OPEN_URL:
                    Open(url);
                    break;

                case BaseActionType.OPEN_FILE:
                    FileHelper.CreateDirectoryIfNeed(FileHelper.TempDirectory);
                    string tempFilePath = FileHelper.TempDirectory + "\\" + "temp." + url.Split('/').Last().Split('.').Last();
                    using (var client = new WebClient())
                        client.DownloadFile(url, tempFilePath);
                    System.Diagnostics.Process.Start(tempFilePath);
                    break;

                case BaseActionType.DOWNLOAD_FILE:
                    using (var client = new WebClient())
                    {
                        client.DownloadFile(url, args["folder"]);
                    }
                    break;
                }
            }
Ejemplo n.º 15
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                if (Application.Current.Windows.Count == 0)
                {
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                }
                else
                {
                    Application.Current.Windows[0].Show();
                }

                Application.Current.Windows[0].ShowInTaskbar = true;

                // Activate the window, bringing it to focus
                Application.Current.Windows[0].Activate();

                // And make sure to maximize the window too, in case it was currently minimized
                Application.Current.Windows[0].WindowState = WindowState.Normal;
            });
        }
        /// <inheritdoc />
        public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                if (arguments.Length == 0)
                {
                    return;
                }

                QueryString args = QueryString.Parse(arguments);

                if (args.Contains("action") == false)
                {
                    LogTo.Warning($"Received a Toast activation without an action argument: '{arguments}'");
                    return;
                }

                switch (args["action"])
                {
                // Restart plugin after crash
                case SMAPluginManager.ToastActionRestartAfterCrash:
                    if (args.Contains(SMAPluginManager.ToastActionParameterPluginId) == false)
                    {
                        LogTo.Error($"Received a ToastActionRestartAfterCrash toast activation without a plugin id parameter: '{arguments}'");
                        return;
                    }

                    var packageId = args[SMAPluginManager.ToastActionParameterPluginId];
                    SMAPluginManager.Instance.StartPlugin(packageId).RunAsync();
                    break;

                default:
                    LogTo.Warning($"Unknown notification action {args["action"]}: '{arguments}'");
                    break;
                }
            });
        }
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            Application.Current.Dispatcher.Invoke(delegate
            {
                if (invokedArgs.Length > 0)
                {
                    ToastActionType actionType = (ToastActionType)int.Parse(invokedArgs.Split('`')[0]);
                    switch (actionType)
                    {
                    case ToastActionType.Url:
                        string url = invokedArgs.Split('`')[1];
                        if (!string.IsNullOrEmpty(url))
                        {
                            //MessageBox.Show("打开URL:" + url);
                            ProcessStartInfo psi = new ProcessStartInfo
                            {
                                FileName        = url,
                                UseShellExecute = true
                            };
                            Process.Start(psi);
                        }
                        break;

                    default:
                        var client = new NamedPipeClientStream(nameof(ProjectEvent));
                        client.Connect();
                        StreamWriter writer = new StreamWriter(client);
                        string input        = "0";
                        writer.WriteLine(input);
                        writer.Flush();
                        break;
                    }
                }
            });
            // TODO: Handle activation
        }
Ejemplo n.º 18
0
 public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
 {
 }
Ejemplo n.º 19
0
 public NotifyActivationMessage(NotifyStatus status, String arguments = null, NotificationUserInput input = null, String model = null, Exception exception = null)
     : this(status, arguments, input?.ToImmutableDictionary(pair => pair.Key, pair => (Object)pair.Value), model, exception)
 {
 }
Ejemplo n.º 20
0
 public NotifyActivationMessage(String arguments, NotificationUserInput input, String model)
     : this(arguments is null || input is null || model is null ? NotifyStatus.Unknown : NotifyStatus.Activated, arguments, input, model)
 {
 }
Ejemplo n.º 21
0
 public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
 {
     throw new NotImplementedException();
     //[Guid("8C11671A-B7C6-4141-ACB2-CEC72D151698")]
 }
Ejemplo n.º 22
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            var dict = new Dictionary<string, string>();
            var splitArgs = invokedArgs.Split("&");
            foreach (var arg in splitArgs)
            {
                if (arg.Contains("="))
                {
                    var split = arg.Split("=");
                    dict.Add(split[0], split[1]);
                }
            }

            if (dict.ContainsKey("action"))
            {

                switch (dict["action"])
                {
                    case "viewUrl":
                        if (dict.ContainsKey("url"))
                        {
                            dict["url"].OpenUrl();
                        }

                        break;
                    case "viewUpdate":
                        var subscribe = bool.Parse(dict["subscribeAlphaBeta"]);
                        var updateForm = new UpdateForm(dict["changes"], subscribe, dict["installerUrl"], dict["version"]);
                        updateForm.ShowDialog();
                        break;
                    case "openDirectory":
                        var directory = dict["path"];
                        var process = new Process
                        {
                            StartInfo = new ProcessStartInfo
                            {
                                FileName = "explorer.exe",
                                Arguments = $"/select, \"{directory}\"",
                                UseShellExecute = true
                            }
                        };
                        process.Start();
                        process.Dispose();
                        break;
                    case "snoozeUpdate":
                        if (userInput.ContainsKey("snooze"))
                        {
                            var value = userInput["snooze"];
                            // Transform key to datetime.
                            var timeToSnooze = value switch
                            {
                                "6h" => TimeSpan.FromHours(6),
                                "12h" => TimeSpan.FromHours(12),
                                "1d" => TimeSpan.FromDays(1),
                                "3d" => TimeSpan.FromDays(3),
                                "1w" => TimeSpan.FromDays(7),
                                _ => TimeSpan.FromDays(1)
                            };

                            Updater.TimeToCheck = (int)timeToSnooze.TotalMilliseconds;
                            Updater.CheckForUpdates();
                        }

                        break;
                    case "uploadVideo":
                        var videoPath = dict["path"];
                        var uploader = Program.ServiceProvider.GetService<Uploader>();
                        if (uploader is { })
                        {
                            uploader.AddToQueue(new FileShell(videoPath));
                        }

                        break;
 public static void ActivateHandler(string invokedArgs, NotificationUserInput userInput)
 {
     Application.Current.Dispatcher.Invoke(async delegate
     {
         if (!invokedArgs.Contains("default null string"))
         {
             try
             {
                 if (invokedArgs.Contains("LIKE!@#$%"))
                 {
                     string text       = invokedArgs.Substring(0, invokedArgs.IndexOf("LIKE!@#$%"));
                     string activityID = text.Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                     string commentID  = invokedArgs.Split(new string[] { "LIKE!@#$%" }, StringSplitOptions.None)[1];
                     await KakaoRequestClass.LikeComment(activityID, commentID, false);
                 }
                 else if (invokedArgs.Contains("REPLY!@#$%"))
                 {
                     string text       = invokedArgs.Substring(0, invokedArgs.IndexOf("REPLY!@#$%"));
                     string[] datas    = invokedArgs.Split(new string[] { "R!@=!!" }, StringSplitOptions.None);
                     string id         = datas[1];
                     string name       = datas[2];
                     string writer     = datas[3];
                     string identity   = datas[4];
                     string msg        = userInput["tbReply"];
                     string activityID = text.Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                     await KakaoRequestClass.ReplyToFeed(activityID, msg, id, name);
                 }
                 else
                 {
                     //MessageBox.Show(invokedArgs);
                     string text       = invokedArgs.Split(new string[] { "!" }, StringSplitOptions.None)[1];
                     string activityID = text.Split(new string[] { "activities/" }, StringSplitOptions.None)[1];
                     string url        = invokedArgs.Split(new string[] { "!" }, StringSplitOptions.None)[0];
                     try
                     {
                         PostData data = await KakaoRequestClass.GetPost(activityID);
                         if (data != null && activityID != null)
                         {
                             PostWindow.ShowPostWindow(data, activityID);
                         }
                     }
                     catch (Exception) { }
                 }
             }
             catch (Exception)
             {
                 try
                 {
                     string id = invokedArgs.Replace("https://story.kakao.com/", "");
                     if (id.Length > 0)
                     {
                         TimeLineWindow tlw = new TimeLineWindow(id);
                         tlw.Show();
                         tlw.Activate();
                     }
                     else
                     {
                         throw new InvalidDataException();
                     }
                 }
                 catch (Exception)
                 {
                     System.Diagnostics.Process.Start(invokedArgs.Split(new string[] { "!" }, StringSplitOptions.None)[0]);
                 }
             }
         }
     });
 }
        public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
        {
            try
            {
                Application.Current.Dispatcher.Invoke(delegate
                {
                    // Tapping on the top-level header launches with empty args
                    if (arguments.Length == 0)
                    {
                        // Perform a normal launch
                        OpenWindowIfNeeded();
                        return;
                    }

                    // Parse the query string (using NuGet package QueryString.NET)
                    QueryString args = QueryString.Parse(arguments);


                    foreach (var i in args)
                    {
                        if (i.Name == "On")
                        {
                            MainWindow.MBoostBtn.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        }
                        else
                        if (i.Name == "Off")
                        {
                            MainWindow.MBoostBtn.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                        }
                        else
                        if (i.Name == "Close")
                        {
                            Application.Current.MainWindow.Close();
                            Application.Current.Shutdown();
                        }
                    }
                    // See what action is being requested

                    switch (args["action"])
                    {
                    // Open the image

                    /*case "viewImage":
                     *
                     *  // The URL retrieved from the toast args
                     *  string imageUrl = args["imageUrl"];
                     *
                     *  // Make sure we have a window open and in foreground
                     *  OpenWindowIfNeeded();
                     *
                     *  // And then show the image
                     *  (App.Current.Windows[0] as MainWindow).ShowImage(imageUrl);
                     *
                     * break;
                     *
                     * // Background: Quick reply to the conversation
                     * case "reply":
                     *
                     *  // Get the response the user typed
                     *  string msg = userInput["tbReply"];
                     *
                     *  // And send this message
                     *  //SendMessage(msg);
                     *
                     *  // If there's no windows open, exit the app
                     *  if (App.Current.Windows.Count == 0)
                     * {
                     *     Application.Current.Shutdown();
                     * }
                     *
                     * break;*/


                    case "On":
                        //MessageBox.Show("On");
                        break;

                    case "Off":
                        //MessageBox.Show("Off");
                        break;
                    }
                });
            }
            catch (Exception)
            {
            }
        }
 public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
 {
 }
Ejemplo n.º 26
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="userInput">Text and selection values that the user entered in your toast.</param>
 /// <param name="appUserModelId">Your AUMID.</param>
 public abstract void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId);
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            var logger = Locator.Current.GetService <ILogger>();

            logger.Write("UI: Toast Activated...", LogLevel.Debug);
        }
Ejemplo n.º 28
0
 public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
 {
     Dispatcher.CurrentDispatcher.Invoke(() => MessageBox.Show("Notification captured"));
 }
Ejemplo n.º 29
0
 public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
 {
     Application.Current.Dispatcher.Invoke(() => {
         Instance?.HandleNotificationActivated(invokedArgs, userInput);
     });
 }
        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;
                    }
                }
            });
        }