Example #1
0
        private async void AlbumDataGridSelectionChanged(object sender, MouseButtonEventArgs e)
        {
            var image = e.OriginalSource as Image;
            if (image != null && image.Name == "PlayTrackImage") return;
            if (SubsonicClient == null) return;

            var albumItem = AlbumDataGrid.SelectedItem as Models.AlbumModel;

            if (albumItem != null)
            {
                MusicDirectoryActivity<System.Drawing.Image> activity = new MusicDirectoryActivity<System.Drawing.Image>(SubsonicClient, albumItem.Child.Id);
                await activity.GetResult(GetCancellationToken("AlbumDataGridSelectionChanged")).ContinueWith(UpdateTrackListingGrid);
            }
        }
Example #2
0
        private async void ArtistTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            if (SubsonicClient == null) return;

            ArtistModel artistItem = e.NewValue as ArtistModel;
            _albumListItem = null;
            AlbumDataGridNext.Visibility = Visibility.Collapsed;

            if (artistItem == null || artistItem.Artist == null) return;

            ProgressIndicator.Visibility = Visibility.Visible;

            MusicDirectoryActivity<System.Drawing.Image> activity = new MusicDirectoryActivity<System.Drawing.Image>(SubsonicClient, artistItem.Artist.Id);
            await activity.GetResult(GetCancellationToken("ArtistTreeViewSelectionItemChanged")).ContinueWith(UpdateAlbumGrid);

            ProgressIndicator.Visibility = Visibility.Hidden;
        }
Example #3
0
        private async void AlbumDataGridMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (SubsonicClient == null) return;
            if (_working) return;

            _working = true;

            var source = e.Source as DataGrid;
            if (source == null) return;

            var selectedAlbum = source.CurrentItem as Models.AlbumModel;

            if (selectedAlbum != null)
            {
                MusicDirectoryActivity<System.Drawing.Image> activity = new MusicDirectoryActivity<System.Drawing.Image>(SubsonicClient, selectedAlbum.Child.Id);
                await activity.GetResult(GetCancellationToken("AlbumDataGridMouseDoubleClick")).ContinueWith(t => AddAlbumToPlaylist(t, _doubleClickBehavior == DoubleClickBehavior.Play, true));
            }

            _working = false;
        }
Example #4
0
        private void PlayAlbumImageMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var test = UiHelpers.GetVisualParent<DataGridRow>(sender);
            var albumItem = test.Item as Models.AlbumModel;

            if (albumItem == null) return;

            Dispatcher.InvokeAsync(() =>
                                  {
                                      StopMusic();

                                      _playbackTrackItems.Clear();

                                      foreach (DataGridColumn column in PlaylistTrackGrid.Columns)
                                      {
                                          column.Width = column.MinWidth;
                                          column.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
                                      }

                                      MusicDirectoryActivity<System.Drawing.Image> activity = new MusicDirectoryActivity<System.Drawing.Image>(SubsonicClient, albumItem.Child.Id);
                                      activity.GetResult(GetCancellationToken("PlayAlbumImageMouseLeftButtonDown")).ContinueWith(t => AddAlbumToPlaylist(t, true, true));
                                  });
        }
Example #5
0
        private async void AlbumDataGridAddClick(object sender, RoutedEventArgs e)
        {
            if (SubsonicClient == null) return;

            foreach (Models.AlbumModel item in AlbumDataGrid.SelectedItems)
            {
                MusicDirectoryActivity<System.Drawing.Image> activity = new MusicDirectoryActivity<System.Drawing.Image>(SubsonicClient, item.Child.Id);
                await activity.GetResult(GetCancellationToken("AlbumDataGridAddClick")).ContinueWith((System.Threading.Tasks.Task<Subsonic.Common.Classes.Directory> t) => AddAlbumToPlaylist(t));
            }
        }