private async void UploadMainVideoBtn_Click(object sender, EventArgs e) { _logger.LogTrace($"{GetType()} - BEGIN {nameof(UploadMainVideoBtn_Click)}"); if (!CheckSelectedRow()) { return; } Progress <UploadStatusModel> progress = new Progress <UploadStatusModel>(status => { UploadProgressBar.Value = (int)status.CompletionRate; ProgressLabel.Text = $"{status.CompletionRate}% ({status.StatusText})"; }); DataGridViewRow row = VideoDGV.SelectedRows[0]; PublicationModel publicationModel = row.DataBoundItem as PublicationModel; DialogResult result = VideoFileDialog.ShowDialog(this); if (result == DialogResult.OK) { VideoModel videoModel = new VideoModel() { Metadata = publicationModel.MainVideo, VideoStream = VideoFileDialog.OpenFile() }; await Task.Run(() => { _videoService.UploadVideoAsync(videoModel, progress, CancellationToken.None); }); } else { MessageBox.Show("OK on fera ça plus tard 😉"); } }
/// <summary> /// Gets the path of the video. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void Button_VideoPath_Click(object sender, EventArgs e) { VideoFileDialog.ShowDialog(); TextBox_VideoPath.Text = VideoFileDialog.FileName; }