private void PostAidKeyResponseMessage(Key key) { var aidKey = key.ToAidKey(KeyboardExt.IsShiftDown()); var msg = new AidKeyResponseMessage(aidKey.Value); this.MasterThread.PostInputMessage(msg); }
private void PostKeyboardInput(Key key) { // send the keyboard input to the master thread. That thread applies input // and WTD commands to the master screenContent block. if (this.MasterThread != null) { var kbInput = new KeyboardInputMessage() { KeyCode = key, ShiftDown = KeyboardExt.IsShiftDown( ) }; this.MasterThread.PostInputMessage(kbInput); // this.MasterThread.MasterQueue.Enqueue(kbInput); } }
private void Item_PreviewKeyDown(object sender, KeyEventArgs e) { string keyText = e.Key.ToTextInput(); if (this.DoHandleUserInput == true) { var modkey = e.ToModifiedKey(); if (keyText != null) { this.CaretCursor = PutKeyboardText_AdvanceCaret(this.CaretCursor, keyText); this.CanvasCaret.StartBlink(this.CaretCursor, true); } else if (e.Key == Key.Tab) { if (Keyboard.IsKeyDown(Key.LeftShift) == false) { this.CaretCursor = this.CaretCursor.NextInputItemCircular( this.VisualItems, VisualFeature.tabTo); } else { this.CaretCursor = this.CaretCursor.PrevInputItemCircular( this.VisualItems, VisualFeature.tabTo); } this.CanvasCaret.StartBlink(this.CaretCursor, true); e.Handled = true; } else if (e.Key == Key.Enter) { if (KeyboardExt.IsShiftDown()) { this.CaretCursor = this.CaretCursor.NextInputItemNextLine(this.VisualItems); this.CanvasCaret.StartBlink(this.CaretCursor); } else { PostAidKeyResponseMessage(e.Key); } } else if (e.Key == Key.Right) { this.CaretCursor = this.CaretCursor.AdvanceRight( this.VisualItems, HowAdvance.NextColumn); this.CanvasCaret.StartBlink(this.CaretCursor); e.Handled = true; } else if (e.Key == Key.Left) { this.CaretCursor = this.CaretCursor.AdvanceLeft( this.VisualItems, HowAdvance.NextColumn); this.CanvasCaret.StartBlink(this.CaretCursor); e.Handled = true; } else if (e.Key == Key.Down) { this.CaretCursor = this.CaretCursor.AdvanceDown(this.VisualItems); this.CanvasCaret.StartBlink(this.CaretCursor); e.Handled = true; } else if (e.Key == Key.Up) { this.CaretCursor = this.CaretCursor.AdvanceUp(this.VisualItems); this.CanvasCaret.StartBlink(this.CaretCursor); e.Handled = true; } else if (e.Key == Key.Back) { this.CaretCursor = this.CaretCursor.AdvanceLeft( this.VisualItems, HowAdvance.NextColumn); if (this.CaretCursor.IsInputItem() == true) { PutKeyboardText(this.CaretCursor, " "); } this.CanvasCaret.StartBlink(this.CaretCursor); e.Handled = true; } else if (e.Key == Key.Delete) { PutKeyboardText(this.CaretCursor, " "); this.CanvasCaret.StartBlink(this.CaretCursor); e.Handled = true; } // escape key. delete hoverbox. else if (e.Key == Key.Escape) { if (this.HoverBox != null) { this.HoverBox.RemoveHoverBox(); } } else if (Array.IndexOf(EnterKeyCodeArray, e.Key) != -1) { PostAidKeyResponseMessage(e.Key); } #if skip else if (e.Key == Key.System) { PostAidKeyResponseMessage(e.Key); e.Handled = true; } #endif SignalCanvasChanged(); } }