private async void downloadButton_Click(object sender, EventArgs e) { try { if (DataValidation.isSavePathValid(savePathTxtBox) == true) { _quality = (qualityFormatComboBox.SelectedItem as DownloadOption).quality; _bitrate = (qualityFormatComboBox.SelectedItem as DownloadOption).bitrate; _format = (qualityFormatComboBox.SelectedItem as DownloadOption).format; bool _isAudio = (qualityFormatComboBox.SelectedItem as DownloadOption).isAudio; await DataService.DownloadItem(titleLabel.Text, _format, _quality, _bitrate, savePathTxtBox.Text, downloadQueueMaterialListView, _isAudio, deleteDoneCheckBox); } else { throw new EmptySavePathException(); } } catch (Exception ex) { DataValidation.CheckException(ex, dataLoadProgressBar); } finally { downloadHistoryDGV.Update(); downloadHistoryDGV.Refresh(); } }
private async void getVideoButton_Click(object sender, EventArgs e) { try { IProgress <int> progress = new Progress <int>(p => { dataLoadProgressBar.Value = p; }); await Task.Run(() => DataService.LoadMetaData(progress, dataLoadProgressBar, qualityFormatComboBox, videoUrlTxtBox, titleLabel, durationLabel, thumbNailPictureBox)); } catch (Exception ex) { DataValidation.CheckException(ex, dataLoadProgressBar); } }