示例#1
0
        public static PlaybackControlWindow GetInstance()
        {
            if (instance == null)
            {
                instance = new PlaybackControlWindow();
            }

            return(instance);
        }
示例#2
0
        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;
        }
示例#3
0
        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);
        }