private void MenuItem_Click(object sender, RoutedEventArgs e) { if (e.Source == menuExit) { Properties.Settings.Default.ControllerLeft = this.Left; Properties.Settings.Default.ControllerTop = this.Top; Properties.Settings.Default.Save(); Application.Current.Shutdown(); } if (e.Source == menuSettings) { NotifyIcon.CloseBalloon(); SettingsWindow frm = new SettingsWindow(); bool playingState = _controller.IsPlaying; _controller.IsPlaying = false; frm.ShowDialog(); _controller.IsPlaying = playingState; } }
private void ShowNotification(INotificationBalloonViewModel notification) { if (notification == null) { return; } var notificationBalloon = new NotificationBalloon(notification); notificationBalloon.ClosingAnimationCompleted += (o, eventArgs) => { NotifyIcon.CloseBalloon(); if (!notification.ClosedCommand.CanExecute(null)) { return; } notification.ClosedCommand.Execute(null); }; // NotificationBalloon handles animation and timeout itself NotifyIcon.ShowCustomBalloon(notificationBalloon, PopupAnimation.None, null); // Place popup against right edge of screen NotifyIcon.CustomBalloon.HorizontalOffset += 1; }
private void Main_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Application.Current.Shutdown(); NotifyIcon.CloseBalloon(); }