public static KeyValuePair <int, Timecode>?GetAmountAndTime() { var form = new FormMarkerCreate(); DialogResult rslt = form.ShowDialog(); if (rslt != DialogResult.OK) { return(null); } int num; if (!int.TryParse(form.numHowMany.Value.ToString(), out num)) { return(null); } Timecode tc = ParseTC(form.tbInterval.Text); if (tc == null) { return(null); } return(new KeyValuePair <int, Timecode>(num, tc)); }
public static KeyValuePair<int, Timecode>? GetAmountAndTime() { var form = new FormMarkerCreate(); DialogResult rslt = form.ShowDialog(); if (rslt != DialogResult.OK) return null; int num; if (!int.TryParse(form.numHowMany.Value.ToString(), out num)) { return null; } Timecode tc = ParseTC(form.tbInterval.Text); if (tc == null) return null; return new KeyValuePair<int, Timecode>(num, tc); }
private void MarkerCreateMultiCommand_Invoked(object sender, EventArgs e) { KeyValuePair <int, Timecode>?data = FormMarkerCreate.GetAmountAndTime(); if (data == null) { return; } int num = data.Value.Key; Timecode interval = data.Value.Value; using (var undo = new UndoBlock("Create multiple markers")) { for (int i = 0; i < num; i++) { Timecode pos = Timecode.FromNanos(myVegas.Transport.CursorPosition.Nanos + (interval.Nanos * i)); myVegas.Project.Markers.Add(new Marker(pos)); } } }