private void AddToUpcomings_Click(object sender, RoutedEventArgs e)
        {
            var track = (PlexTrack)((MenuItem)e.Source).DataContext;

            var upcomings = UpcomingManager.GetInstance();

            upcomings.Push(track);
        }
Esempio n. 2
0
        private void MenuItem_AddToUpcomings_Click(object sender, RoutedEventArgs e)
        {
            var track = (PlexTrack)((MenuItem)e.Source).DataContext;

            var upcomings = UpcomingManager.GetInstance();

            upcomings.Push(track);

            var mainWindow = MainWindow.GetInstance();

            mainWindow.FlashPlayQueue();
        }
Esempio n. 3
0
        private void TrackButton_DeleteClick(object sender, RoutedEventArgs e)
        {
            var index = ItemsControlHelper.FindIndexByItemChild(panelTracks, sender as DependencyObject);

            if (index == -1)
            {
                return;
            }

            var upcomings = UpcomingManager.GetInstance();

            upcomings.Remove(index);
        }
Esempio n. 4
0
        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            var playbackControl = PlaybackManager.GetInstance();

            playbackControl.StartPlaying         -= PlaybackControl_StartPlaying;
            playbackControl.PlaybackTick         -= PlaybackControl_PlaybackTick;
            playbackControl.PlaybackStateChanged -= PlaybackControl_PlaybackStateChanged;

            var upcomings = UpcomingManager.GetInstance();

            upcomings.TrackChanged -= Upcomings_TrackChanged;

            artworkResizeTokenSource.Cancel();
        }
Esempio n. 5
0
        void IDropTarget.Drop(IDropInfo dropInfo)
        {
            var source    = (Component.TrackButton)VisualTreeHelper.GetChild(dropInfo.DragInfo.VisualSourceItem, 0);
            int sourceIdx = ItemsControlHelper.FindIndexByItemChild(panelTracks, source);
            int targetIdx = dropInfo.InsertIndex;

            if (sourceIdx == targetIdx || sourceIdx == -1 || targetIdx == -1)
            {
                return;
            }

            var upcomings = UpcomingManager.GetInstance();

            upcomings.Rearrange(sourceIdx, targetIdx);
        }
Esempio n. 6
0
        private void Upcomings_TrackChanged(object sender, EventArgs e)
        {
            var app = (App)Application.Current;

            Task.Factory.StartNew(() =>
            {
                var upcomings = UpcomingManager.GetInstance();
                Upcomings.FromArray(upcomings.GetArray());

                panelTracksContainer.Visibility = Upcomings.Count == 0 ? Visibility.Collapsed : Visibility.Visible;

                var scrollViewer = (ScrollViewer)VisualTreeHelper.GetChild(panelTracks, 0);
                scrollViewer.ScrollToVerticalOffset(0);
            }, CancellationToken.None, TaskCreationOptions.None, app.uiContext);
        }
Esempio n. 7
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            var playbackControl = PlaybackManager.GetInstance();

            playbackControl.StartPlaying         += PlaybackControl_StartPlaying;
            playbackControl.PlaybackTick         += PlaybackControl_PlaybackTick;
            playbackControl.PlaybackStateChanged += PlaybackControl_PlaybackStateChanged;

            var upcomings = UpcomingManager.GetInstance();

            upcomings.TrackChanged += Upcomings_TrackChanged;
            Upcomings_TrackChanged(this, e);

            Track = playbackControl.Track;
            LoadArtwork();
        }