private void MainTextEditor_KeyDown(object sender, KeyEventArgs e) { //CTRL + B pressed => toggle breakpoint on current line if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.B)) { MainTextEditor.ToggleBreakpoint(); } }
//-------------- ------------ Status bar count ---------------------------------------- //Name : MainTextEditor_TextChanged //Purpose : to update the current count of lines, characters and file name in the document //Inputs : Object , RoutedEventsArgs //Outputs : NONE //Returns : Void private void MainTextEditor_TextChanged(object sender, RoutedEventArgs e) { //get the total count of all characters int TotalCharCount = MainTextEditor.Text.Length; //gets the current row (line) of the cursor position, add 1 since count starts at 0 int CurrentLine = MainTextEditor.GetLineIndexFromCharacterIndex(MainTextEditor.CaretIndex); //gets initial value of current Line int FirstCharOfLine = MainTextEditor.GetCharacterIndexFromLineIndex(CurrentLine); // calculation to current char count for cursor in current line int LineCharCount = MainTextEditor.CaretIndex - FirstCharOfLine; //Display info in status bar TbCharCount.Text = "Line: " + (CurrentLine + 1) + ", Char: " + LineCharCount + "\t\t\t Total chars: " + TotalCharCount + "\t\t\t Filename: " + CurrentFile; }
private void OnWorkAreaEditorMessageWindowHiddenEvent() { MainTextEditor?.Focus(); }