private void goToEpochToolStripMenuItem_Click(object sender, EventArgs e) { using (OneFieldDialog dialog = new OneFieldDialog("Go To...", "Epoch", String.Empty)) { if (dialog.ShowDialog() == DialogResult.OK) { int epoch; if (Int32.TryParse(dialog.Value, out epoch)) { eventsView.ShowEpoch(epoch); } } } }
private void goToOffsetframesToolStripMenuItem_Click(object sender, EventArgs e) { using (OneFieldDialog dialog = new OneFieldDialog("Go To...", "Offset (frames)", dataGridViewEpochs.CurrentRow != null ? top.Epochs[dataGridViewEpochs.CurrentRow.Index].FrameBase.ToString() : String.Empty)) { if (dialog.ShowDialog() == DialogResult.OK) { long offset; if (Int64.TryParse(dialog.Value, out offset)) { int i = BinarySearchHelper.BinarySearch(top.Epochs, 0, top.Epochs.Count, offset, delegate(Epoch l, long r) { return(l.FrameBase.CompareTo(r)); }); if (i < 0) { i = ~i; } this.dataGridViewEpochs.ClearSelection(); this.dataGridViewEpochs.Rows[i].Selected = true; this.dataGridViewEpochs.CurrentCell = this.dataGridViewEpochs.Rows[i].Cells[0]; // scroll into view } } } }