private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if (qualitySelectListBox.SelectedItem == null) { PrimaryButtonText = "请选择清晰度"; await Task.Delay(2000); PrimaryButtonText = "下载"; return; } this.needToClose = true; this.Hide(); try { await DownloadHelper.CreateDownloadAsync (vm.Bv, vm.Cid, this.QualitySelectionProperty, ApplicationData.Current.LocalSettings.Values["biliUserSESSDATA"] as string, XamlRoot); } catch (ParsingVideoException ex) { var dialog = new ErrorDialog(ex.Message, XamlRoot); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { MainPage.ContentFrame.Navigate(typeof(UserPage)); MainPage.NavView.SelectedItem = MainPage.NavViewItems[2]; } } catch (DirectoryNotFoundException ex) { var dialog = new ExceptionDialog(ex.Message, XamlRoot); _ = await dialog.ShowAsync(); } }