private async void MenuFlyoutAlbum_Click(object sender, RoutedEventArgs e) { if (SongFlyout.Target is SelectorItem s) { AlbumViewModel viewModel = null; switch (s.Content) { case GenericMusicItemViewModel g: viewModel = await g.FindAssociatedAlbumAsync(); break; case SongViewModel song: viewModel = await song.GetAlbumAsync(); break; case AlbumViewModel album: viewModel = album; break; case ArtistViewModel artist: break; default: break; } var dialog = new AlbumViewDialog(viewModel); await dialog.ShowAsync(); } }
private async void OnlineList_ItemClick(object sender, ItemClickEventArgs e) { if ((e.ClickedItem as GenericMusicItemViewModel).InnerType == MediaType.Placeholder) { await Context.ShowMoreOnlineList(); return; } MainPage.Current.ShowModalUI(true, Consts.Localizer.GetString("WaitingResultText")); var result = await Context.GetPlaylistAsync(e.ClickedItem as GenericMusicItemViewModel); if (result != null) { var dialog = new AlbumViewDialog(result); MainPage.Current.ShowModalUI(false); await dialog.ShowAsync(); } else { MainPage.Current.ShowModalUI(false); } }
private async void OpenAlbumViewDialog(object sender, RoutedEventArgs e) { var dialog = new AlbumViewDialog(await Context.GetAlbumAsync()); await dialog.ShowAsync(); }
private async void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { if (args.ChosenSuggestion is GenericMusicItemViewModel g) { if (g.Title.IsNullorEmpty()) { return; } if (g.InnerType == MediaType.Placeholder) { SearchBox.Text = g.Title; return; } if (g.InnerType == MediaType.Album) { var view = new AlbumViewDialog(await g.FindAssociatedAlbumAsync()); var result = await view.ShowAsync(); } else { var t = Task.Run(async() => { await SQLOperator.Current().SaveSearchHistoryAsync(g.Title); }); var dialog = new SearchResultDialog(g); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { ShowModalUI(true, "Prepare to Show"); var view = new AlbumViewDialog(await g.FindAssociatedAlbumAsync()); ShowModalUI(false); result = await view.ShowAsync(); } } } else { if (Context.SearchItems.IsNullorEmpty()) { var dialog = new SearchResultDialog(); var result = await dialog.ShowAsync(); } else { if (Context.SearchItems[0].InnerType == MediaType.Placeholder) { SearchBox.Text = Context.SearchItems[0].Title; return; } var t = Task.Run(async() => { await SQLOperator.Current().SaveSearchHistoryAsync(Context.SearchItems[0].Title); }); if (Context.SearchItems[0].InnerType == MediaType.Album) { var view = new AlbumViewDialog(await Context.SearchItems[0].FindAssociatedAlbumAsync()); var result = await view.ShowAsync(); } else { var dialog = new SearchResultDialog(Context.SearchItems[0]); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { ShowModalUI(true, "Prepare to Show"); var view = new AlbumViewDialog(await Context.SearchItems[0].FindAssociatedAlbumAsync()); ShowModalUI(false); result = await view.ShowAsync(); } } } } sender.Text = string.Empty; }