void listViewProcessingScript_ItemActivate(object sender, EventArgs e) { switch ((sender as ListView).FocusedItem.Text) { case "Caption": using (var form = new CaptionForm(Filters.Caption)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Caption = form.GeneratedFilter; } } break; case "Crop": using (var form = new CropForm(Filters.Crop)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Crop = form.GeneratedFilter; SetSlices(); } } break; case @"Dub": using (var form = new DubForm(Filters.Dub)) { if (form.ShowDialog(this) == DialogResult.OK) { var oldfilter = Filters.Dub; Filters.Dub = form.GeneratedFilter; if (oldfilter.Mode != DubMode.TrimAudio || Filters.Dub.Mode != DubMode.TrimAudio) // the video duration may have changed UpdateArguments(sender, e); } } break; case "Multiple Trim": using (var form = new MultipleTrimForm(Filters.MultipleTrim)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.MultipleTrim = form.GeneratedFilter; UpdateArguments(sender, e); } } break; case "Overlay": using (var form = new OverlayForm(Filters.Overlay)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Overlay = form.GeneratedFilter; } } break; case "Rate": using (var form = new RateForm(Filters.Rate)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Rate = form.GeneratedFilter; UpdateArguments(sender, e); } } break; case "Resize": using (var form = new ResizeForm(Filters.Resize)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Resize = form.GeneratedFilter; SetSlices(); } } break; case "Subtitle": using (var form = new SubtitleForm(Filters.Subtitle)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Subtitle = form.GeneratedFilter; } } break; case "Trim": using (var form = new TrimForm(Filters.Trim)) { if (form.ShowDialog(this) == DialogResult.OK) { Filters.Trim = form.GeneratedFilter; UpdateArguments(sender, e); } } break; default: MessageBox.Show("This filter has no options."); break; } }
void buttonOverlay_Click(object sender, EventArgs e) { using (var form = new OverlayForm()) { if (form.IsDisposed) // The user cancelled the file picker return; if (form.ShowDialog(this) == DialogResult.OK) { if (boxAdvancedScripting.Checked) { textBoxProcessingScript.AppendText(Environment.NewLine + form.GeneratedFilter.ToString()); } else { Filters.Overlay = form.GeneratedFilter; listViewProcessingScript.Items.Add("Overlay", "overlay"); (sender as ToolStripItem).Enabled = false; } } } }