void controler_SpotifyStatusChanged(Controller.SpotifyController sender, SpotifyStatus obj) { if (obj == SpotifyStatus.TrackChanged || obj == SpotifyStatus.Playing) { this.Dispatcher.BeginInvoke(new Action <Controller.SpotifyController>(ShowBalloon), sender); } }
public MainWindow() { InitializeComponent(); _instance = this; //Workaround to set icon BitmapImage icon = (BitmapImage)Application.Current.FindResource("ApplicationIcon"); this.Icon = BitmapFrame.Create(new Uri(icon.BaseUri, icon.UriSource)); this.Left = Properties.Settings.Default.ControllerLeft; this.Top = Properties.Settings.Default.ControllerTop; _controller = new Controller.SpotifyController(); _controller.SpotifyStatusChanged += controler_SpotifyStatusChanged; if (_controller.IsPlaying) { ShowBalloon(_controller); } this.DataContext = _controller; }