/// <summary> /// Called for every OnKeyUp /// </summary> /// <param name="uie"></param> /// <param name="e"></param> public void ProcessKey(FrameworkElement uie, KeyEventArgs e) { if (uie.IsMouseCaptured) { uie.ReleaseMouseCapture(); } char displayChar = KeyControl.GetDisplayChar(e.Key); if (Properties.Settings.Default.GameMode) { // if we're in game mode then send the input to the demandController pauseSpeechForDemand = demandController.ProcessInput(displayChar); } AddFigure(uie, displayChar.ToString()); }
public static char GetDisplayChar(Key key) { // If a number on the normal number track is pressed, display the number. if (key >= Key.D0 && key <= Key.D9) { return((char)('0' + key - Key.D0)); } // If a number on the numpad is pressed, display the number. if (key >= Key.NumPad0 && key <= Key.NumPad9) { return((char)('0' + key - Key.NumPad0)); } try { return(char.ToUpperInvariant(KeyControl.TryGetLetter(key))); } catch (Exception ex) { System.Diagnostics.Debug.Assert(false, ex.ToString()); return('*'); } }