Example #1
0
        public void Push(PlexTrack track)
        {
            lock (tracks)
                tracks.AddFirst(track);

            TrackChanged?.Invoke(this, new EventArgs());
        }
Example #2
0
        private NotificationWindow(PlexTrack track)
        {
            InitializeComponent();
            tokenSource = new CancellationTokenSource();

            Title = track.Title + " - " + track.Artist.Title;

            // load artwork
            var app = (App)System.Windows.Application.Current;

            if (track.Thumb == null)
            {
                imageArtwork.Visibility     = Visibility.Collapsed;
                imageArtworkNone.Visibility = Visibility.Visible;
            }
            else
            {
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource   = app.plexClient.GetPhotoTranscodeUrl(track.Thumb, 50, 50);
                bitmap.CacheOption = BitmapCacheOption.Default;
                bitmap.EndInit();

                imageArtwork.Source = bitmap;

                imageArtwork.Visibility     = Visibility.Visible;
                imageArtworkNone.Visibility = Visibility.Collapsed;
            }

            var playback = PlaybackManager.GetInstance();

            playback.PlaybackTick += Playback_PlaybackTick;
        }
Example #3
0
        void IDropTarget.DragOver(IDropInfo dropInfo)
        {
            PlexTrack sourceItem = dropInfo.Data as PlexTrack;
            PlexTrack targetItem = dropInfo.TargetItem as PlexTrack;

            if (sourceItem != null && targetItem != null && dropInfo.DragInfo.VisualSource == dropInfo.VisualTarget)
            {
                dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
                dropInfo.Effects           = DragDropEffects.Move;
            }
        }
Example #4
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);
        }