/// <summary>The go to line form_ load.</summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void GoToLineForm_Load(object sender, EventArgs e) { INavigatableDocument navDoc = _services.HostWindow.ActiveChildForm as INavigatableDocument; if (navDoc != null) { LineValue = (navDoc.CursorLine + 1).ToString(); Text = string.Format("{0} (1-{1})", Text, navDoc.TotalLines); } }
/// <summary>The btn ok_ click.</summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void btnOk_Click(object sender, EventArgs e) { INavigatableDocument navDoc = _services.HostWindow.ActiveChildForm as INavigatableDocument; if (navDoc != null) { int line; if (int.TryParse(LineValue, out line)) { int column = 0; line = Math.Abs(line - 1); // todo - copy column? if (navDoc.SetCursorByLocation(line, column)) { Close(); } } // otherwise SystemSounds.Beep.Play(); } }