private void Setup() { bool encode = this.userSettingService.GetUserSetting <bool>(UserSettingConstants.NotifyOnEncodeDone); bool queue = this.userSettingService.GetUserSetting <bool>(UserSettingConstants.NotifyOnQueueDone); if (encode || queue) { if (isInitialised) { return; } this.notifier = ToastNotificationManagerCompat.CreateToastNotifier(); isInitialised = true; ToastNotificationManagerCompat.OnActivated += toastArgs => { // Obtain the arguments from the notification ToastArguments args = ToastArguments.Parse(toastArgs.Argument); // Remove any notifications that are clicked System.Collections.Generic.KeyValuePair <string, string> tag = args.FirstOrDefault(); if (!string.IsNullOrEmpty(tag.Value)) { try { ToastNotificationManagerCompat.History.Remove(tag.Value); } catch (Exception exc) { Debug.WriteLine(exc); } } // Need to dispatch to UI thread if performing UI operations Application.Current.Dispatcher.Invoke(delegate { Window w = Application.Current.MainWindow; if (w != null) { w.WindowState = WindowState.Normal; w.BringIntoView(); } }); }; } }