public static PlaybackControlWindow GetInstance() { if (instance == null) { instance = new PlaybackControlWindow(); } return(instance); }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); // unregister event handler var playback = PlaybackManager.GetInstance(); playback.PlaybackStateChanged -= Playback_PlaybackStateChanged; playback.PlaybackTick -= Playback_PlaybackTick; playback.VolumeChanged -= Playback_VolumeChanged; // .net will destroy this instance instance = null; }
public static void Notify(PlexTrack track) { var app = (App)System.Windows.Application.Current; Task.Factory.StartNew(() => { if (notificationWindow != null) { notificationWindow.Close(); } // do not show notification if the mini player is present if (PlaybackControlWindow.IsInstantiated()) { return; } notificationWindow = new NotificationWindow(track); notificationWindow.Show(); }, CancellationToken.None, TaskCreationOptions.None, app.uiContext); }