private void AlbumsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (AlbumsListView.SelectedIndex != -1) { var Await = Tools.VkApi.Audio.GetPopularAsync(false, (VkNet.Enums.AudioGenre)((AlbumModel)AlbumsListView.SelectedItem).ID, 1000, 0).GetAwaiter(); Await.OnCompleted(() => { Tools.AddDataToObservationCollection(AudioCollection, Await.GetResult()); SuccesLoadPanel.Visibility = Visibility.Collapsed; }); AlbumTitleText.Text = ((AlbumModel)AlbumsListView.SelectedItem).Title; AlbumsListView.SelectedIndex = -1; SuccesLoadPanel.Visibility = Visibility.Visible; AlbumGrid.Visibility = Visibility.Visible; this.AlbumsListView.Visibility = Visibility.Collapsed; ShowPlaylistAnimation.From = new Thickness(0, 0, 0, this.AlbumsListView.ActualHeight); ShowPlaylistAnimation.To = new Thickness(0, 0, 0, 0); ShowPlaylistAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.4)); AlbumGrid.BeginAnimation(MarginProperty, ShowPlaylistAnimation); } }
private void BackAlbumListButton_Click(object sender, RoutedEventArgs e) { this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { AudioCollection.Clear(); this.AlbumsListView.Visibility = Visibility.Visible; HidePlaylistAnimation.Completed += HidePlaylistAnimation_Completed; HidePlaylistAnimation.From = new Thickness(0, 0, 0, 0); HidePlaylistAnimation.To = new Thickness(0, 0, 0, this.AlbumsListView.ActualHeight); HidePlaylistAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.4)); AlbumGrid.BeginAnimation(MarginProperty, HidePlaylistAnimation); })); }