public void Crop(string input, string output) { string start = string.Empty; string end = string.Empty; try { // Call 'ValidateText().ToString()' because it will throw a // exception if there is a error in the text. mtxtFrom.ValidateText().ToString(); start = mtxtFrom.Text; if (chbCropTo.Enabled && chbCropTo.Checked) { mtxtTo.ValidateText().ToString(); end = mtxtTo.Text; } } catch { MessageBox.Show(this, "Cropping information error."); return; } CroppingListViewItem item = new CroppingListViewItem(Path.GetFileName(output)); item.SubItems.Add(""); item.SubItems.Add("Cropping"); item.SubItems.Add(FormatVideoLength(FfmpegHelper.GetDuration(input))); item.SubItems.Add(GetFileSize(input)); item.SubItems.Add(""); lvQueue.Items.Add(item); SelectOneItem(item); ProgressBar pb = new ProgressBar() { Maximum = 100, Minimum = 0, Value = 0 }; lvQueue.AddEmbeddedControl(pb, 1, item.Index); LinkLabel ll = new LinkLabel() { Text = Path.GetFileName(input), Tag = input }; ll.LinkClicked += linkLabel_LinkClicked; lvQueue.AddEmbeddedControl(ll, 5, item.Index); item.Crop(input, output, start, end); }
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.SubItems[2].Text = "Success"; this.SubItems[3].Text = MainForm.FormatVideoLength(FfmpegHelper.GetDuration(this.Input)); this.SubItems[4].Text = MainForm.GetFileSize(this.Output); this.Status = OperationStatus.Success; Program.RunningWorkers.Remove(backgroundWorker); OnOperationComplete(new OperationEventArgs(this, this.Status)); }