private ToastDisplayer CreateAdapter(IToast toast = null) { var taskbarIconAdapter = new ToastDisplayer(toast ?? new Toast(new TaskbarIcon())); _itemsToDispose.Push(taskbarIconAdapter); return(taskbarIconAdapter); }
private PlayerNotifier GetPlayerNotifier(Views.MainWindow mainWindow) { PlayerNotifier playerNotifier = null; //create the notifyicon (it's a resource declared in NotifyIconResources.xaml var notifyIcon = (TaskbarIcon)FindResource("NotifyIcon"); if (notifyIcon == null) { return(null); } notifyIcon.Icon = Icons.Resources.Logo; var toast = new Toast(notifyIcon); var taskbarIconAdapter = new ToastDisplayer(toast); playerNotifier = new PlayerNotifier(taskbarIconAdapter); notifyIcon.DataContext = mainWindow.ViewModel; return(playerNotifier); }
private static void ShowReminderNotification() { var application = Application.Current; if (application != null) { var notifyIcon = (TaskbarIcon)application.FindResource("NotifyIcon"); if (notifyIcon == null) { return; } notifyIcon.Icon = Icons.Resources.Logo; var toast = new Toast(notifyIcon); var toastDisplayer = new ToastDisplayer(toast); toastDisplayer.ShowNotificationBubble("Reminder", Environment.NewLine + "This is your daily reminder." + Environment.NewLine + "The reminder schedule can be accessed from the tray icon context menu.", 7200000); } }