Пример #1
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            // unregister event
            var playback = PlaybackManager.GetInstance();

            playback.PlaybackTick -= Playback_PlaybackTick;

            tokenSource.Cancel();
            notificationWindow = null;
        }
Пример #2
0
        private PlaybackControlWindow()
        {
            InitializeComponent();

            // hide all notification
            NotificationWindow.HideAll();

            // event handler
            var playback = PlaybackManager.GetInstance();

            playback.PlaybackStateChanged += Playback_PlaybackStateChanged;
            playback.PlaybackTick         += Playback_PlaybackTick;
            playback.VolumeChanged        += Playback_VolumeChanged;

            // invoke all event handlers
            Playback_PlaybackStateChanged(this, new EventArgs());
            Playback_PlaybackTick(this, new EventArgs());
            Playback_VolumeChanged(this, new EventArgs());
        }
Пример #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);
        }