private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (mainClass == null) { mainClass = new frmMain(); } mainClass.CallShortcutKeys(e, IsAlredyCallProperty); IsAlredyCallProperty = true; }
// private void BraileBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (mainClass == null) { mainClass = new frmMain(); } mainClass.CallShortcutKeys(e, IsAlredyCallProperty); IsAlredyCallProperty = true; //F2 key edit selection in braille code if (e.Key == Key.F2 && !String.IsNullOrEmpty(BraileBox.Selection.Text)) { int startIndex = this.BraileBox.Document.ContentStart.GetOffsetToPosition(this.BraileBox.Selection.Start); int endIndex = this.BraileBox.Document.ContentStart.GetOffsetToPosition(this.BraileBox.Selection.End); TextPointer startTextPointer = this.TextBox.Document.ContentStart.GetPositionAtOffset(startIndex); TextPointer endTextPointer = this.TextBox.Document.ContentStart.GetPositionAtOffset(endIndex); TextBox.Selection.Select(startTextPointer, endTextPointer); TextBox.Focus(); } }