/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void contextLinesGoToLine_Click(object sender, EventArgs e) { using (FormGoToLine f = new FormGoToLine()) { DialogResult dr = f.ShowDialog(this); if (dr == DialogResult.Cancel) { return; } listLines.EnsureVisible(f.LineNumber - 1); var ll = this.lf.Lines.SingleOrDefault(x => x.LineNumber == f.LineNumber); if (ll != null) { listLines.SelectedIndex = ll.LineNumber - 1; if (listLines.SelectedItem != null) { listLines.FocusedItem = listLines.SelectedItem; } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void contextLinesGoToLine_Click(object sender, EventArgs e) { using (FormGoToLine f = new FormGoToLine()) { DialogResult dr = f.ShowDialog(this); if (dr == DialogResult.Cancel) { return; } LogFile lf = logs[tabControl.SelectedTab.Tag.ToString()]; lf.List.EnsureVisible(f.LineNumber - 1); var ll = lf.Lines.SingleOrDefault(x => x.LineNumber == f.LineNumber); if (ll != null) { lf.List.SelectedIndex = ll.LineNumber - 1; if (lf.List.SelectedItem != null) { lf.List.FocusedItem = lf.List.SelectedItem; } } } }