private void lblDragTrimVideo_DragDrop(object sender, DragEventArgs e) { if (this.isProcessing) { return; } string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); List <string> allowedFiles = new List <string>(); AddNewFilesToList(files, videoExt, allowedFiles); if (allowedFiles.Count == 0) { this.statusInfo.Text = "None of the dragged files were supported video files."; return; } string filename = allowedFiles[0]; if (this.fileList.Contains(filename)) { this.statusInfo.Text = "Dragged file is already in the list."; return; } frmVideoTrim trimmer = new frmVideoTrim(filename); DialogResult dialogResult = trimmer.ShowDialog(this); switch (dialogResult) { case DialogResult.OK: Tuple <double, double> startStop = trimmer.GetTimeRange(); this.trimRanges.Add(startStop); this.trimFiles.Add(filename); this.fileList.Add(filename); this.statusInfo.Text = "1 new file was added."; SetFileCount(); break; default: this.statusInfo.Text = "0 new files were added. Trimming was cancelled."; break; } trimmer.Dispose(); }
private void lblDragTrimVideo_DragDrop(object sender, DragEventArgs e) { if (MP.isProcessing) { return; } string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); string[] allowedFiles = MP.GetAllowedVideoFiles(files); if (allowedFiles.Length == 0) { this.statusInfo.Text = "None of the dragged files were supported video files."; return; } string filename = allowedFiles[0]; if (MP.IsInList(filename)) { this.statusInfo.Text = "Dragged file is already in the list."; return; } using (frmVideoTrim trimmer = new frmVideoTrim(filename)) { DialogResult dialogResult = trimmer.ShowDialog(this); switch (dialogResult) { case DialogResult.OK: Tuple <double, double> startStop = trimmer.GetTimeRange(); MP.AddTrimmedVideo(filename, startStop); this.statusInfo.Text = "1 new file was added."; SetFileCount(); break; default: this.statusInfo.Text = "0 new files were added. Trimming was cancelled."; break; } } }