public static bool IsKeyDown(KeyPadKey key) { if (Utils.IsInterNet2) { return IsKeyDown_Internal(key); } else { return WindowsScreen.WinScreen.IsKeyDown(key); } }
public static bool IsKeyDown(KeyPadKey key) { if (Utils.IsInterNet2) { return(IsKeyDown_Internal(key)); } else { return(WindowsScreen.WinScreen.IsKeyDown(key)); } }
public bool LatestKeyDown(out KeyPadKey key) { if (this.latestKeyDown.HasValue) { key = this.latestKeyDown.Value; this.latestKeyDown = null; return(true); } else { key = KeyPadKey.B0; return(false); } }
protected override void OnKeyUp(KeyEventArgs e) { bool isValid; KeyPadKey key = this.MapKey(e.KeyCode, out isValid); if (isValid) { e.Handled = true; this.keyState[(int)key] = false; this.latestKeyUp = key; return; } base.OnKeyUp(e); }
public static bool LatestKeyDown(out KeyPadKey key) { if (Utils.IsInterNet2) { int iKey = LatestKeyDown_Internal(); if (iKey >= 0) { key = (KeyPadKey)iKey; return true; } else { key = KeyPadKey.B0; return false; } } else { return WindowsLatestKeyDown(out key); } }
public static bool LatestKeyDown(out KeyPadKey key) { if (Utils.IsInterNet2) { int iKey = LatestKeyDown_Internal(); if (iKey >= 0) { key = (KeyPadKey)iKey; return(true); } else { key = KeyPadKey.B0; return(false); } } else { return(WindowsLatestKeyDown(out key)); } }
private static bool WindowsLatestKeyDown(out KeyPadKey key) { return(WindowsScreen.WinScreen.LatestKeyDown(out key)); }
extern private static bool IsKeyDown_Internal(KeyPadKey key);
public bool IsKeyDown(KeyPadKey key) { return(this.keyState[(int)key]); }
private static extern bool IsKeyDown_Internal(KeyPadKey key);
private static bool WindowsLatestKeyUp(out KeyPadKey key) { return WindowsScreen.WinScreen.LatestKeyUp(out key); }
public bool LatestKeyDown(out KeyPadKey key) { if (this.latestKeyDown.HasValue) { key = this.latestKeyDown.Value; this.latestKeyDown = null; return true; } else { key = KeyPadKey.B0; return false; } }
public bool IsKeyDown(KeyPadKey key) { return this.keyState[(int)key]; }
private async void Device_KeyPressed(KeyPadKey key1) { var key = new KeyInfo(key1); //if (args.VirtualKey == VirtualKey.Back) // await SayIt("Matties butt plus lizzy sprinkles is the tastiest flavor of icecream in the universe!"); //if (args.VirtualKey == VirtualKey.NumberKeyLock || args.VirtualKey == VirtualKey.Decimal) //{ // var txt = @"<speak version='1.0' " + // "xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>" + // "<prosody speed='x-fast' pitch='+80%'>chocolate flavored diarea is maliks favorite treat!</prosody> " + // "</speak>"; // var s = await ss.SynthesizeSsmlToStreamAsync(txt); // me.SetSource(s, s.ContentType); // await me.PlayAsync(); //} if (key.Key == KeyPadKey.Divide || key.Key == KeyPadKey.Multiply) { if (key.Key == KeyPadKey.Divide & SoundUtilities.Volume > 0) { SoundUtilities.Volume = Math.Max(SoundUtilities.Volume - .1f, 0); } if (key.Key == KeyPadKey.Multiply & SoundUtilities.Volume < 1) { SoundUtilities.Volume = Math.Min(SoundUtilities.Volume + .1f, 1); } device.LcdDisplay.Clear(); device.LcdDisplay.SetCursor(0, 0); device.LcdDisplay.Print("Volume: " + (int)(SoundUtilities.Volume * 100)); answerDisplayed = true; return; } if (key.Key == KeyPadKey.Decimal) { //greeted.Clear(); /* if (timer.IsEnabled) * timer.Stop(); * else * timer.Start();*/ //FaceManager.SetFace(Faces.Angry); //ListenAsync(); //SpeechService.Instance.Initialize(); //device.SayIt("If you only knew the power of the darkside"); return; } if (key.IsNumber) { if (answerDisplayed) { answerDisplayed = false; device.LcdDisplay.Clear(); device.LcdDisplay.SetCursor(0, 0); } if (operation == null) { num1 += key.Text; } else { num2 += key.Text; } device.LcdDisplay.Print(key.Text); await device.SayIt(key.SpeechText); } else if (num1.Length > 0 && key.IsOperation) { operation = key; device.LcdDisplay.Print(key.Text); await device.SayIt(key.SpeechText); } else if (key.IsEnter && num2.Length > 0) { double number1 = double.Parse(num1); double number2 = double.Parse(num2); double answer = 0; if (operation.Key == KeyPadKey.Add) { answer = number1 + number2; } else if (operation.Key == KeyPadKey.Subtract) { answer = number1 - number2; } else if (operation.Key == KeyPadKey.Divide) { answer = number1 / number2; } else if (operation.Key == KeyPadKey.Multiply) { answer = number1 * number2; } FaceManager.SetFace(Faces.Happy); device.LcdDisplay.Print("=" + answer + Environment.NewLine); answerDisplayed = true; await this.device.MouthDisplay.DrawString($"{number1}{operation.Text}{number2}={answer}"); //await SayIt(num2); //await SayIt("equals"); //await SayIt(answer.ToString()); await device.SayIt($"{number1.ToString()} {operation.SpeechText} {number2.ToString()} equals {answer}"); num1 = string.Empty; num2 = string.Empty; operation = null; } }
public KeyInfo(KeyPadKey key) { Key = key; }