/// <summary> /// Sends text to the terminal. /// This is used for typical alphanumeric text entry. /// </summary> /// <param name="text">The text to send</param> internal void SendText(string text, bool automated = false) { try { if (this.emu.IsConnected) { enterKeyPressed = false; textKeyPressed = true; if (!automated) { ScreenField xf = GetCurrentField(); if (xf.Attributes.FieldType == "Hidden" && xf.Attributes.Protected == false) { Tolk.Silence(); Tolk.Speak("", true); } } this.emu.SetText(text); if (!automated) { Refresh(); textKeyPressed = false; } } } catch (TNHostException tnHostException) { log.Warn("Exceção TNHostException em terminal.SendText", tnHostException); } catch (Exception e) { log.Error("Exceção não esperada em terminal.Sendtext", e); emu_Disconnected(emu, e.Message); } }
void ExecuteSpeakCommand(object sender, ExecutedRoutedEventArgs args) { ScreenField xf = null; switch ((String)args.Parameter) { case "A": Tolk.Speak(Console.Text.Trim(), true); break; case "S": Tolk.Silence(); break; case "D": Tolk.Speak(Console.Text.Substring((Terminal.GetCaretIndex() / 81) * 81, 80).Trim().Replace("|", "")); break; case "X": xf = Terminal.GetCurrentField(); if (xf != null) { Tolk.Speak(Console.Text.Substring(xf.Location.position + xf.Location.top, xf.Location.length).Trim().Replace("|", "")); } break; case "Z": xf = Terminal.GetCurrentField(); if (xf != null) { ScreenField xf1 = Terminal.GetPreviousField(xf); if (xf1 != null && xf1.Text != null && xf1.Location.top == xf.Location.top) { Tolk.Speak(xf1.Text.Trim().Replace("|", "")); } else { ScreenField xf2 = Terminal.GetNextUnprotectedField(xf); if (xf2 != null && xf2.Location.top == xf.Location.top) { Tolk.Speak(Console.Text.Substring(xf.Location.position + xf.Location.top + xf.Location.length, (xf2.Location.position + xf2.Location.top) - (xf.Location.position + xf.Location.top + xf.Location.length)).Replace("|", "")); } else { Tolk.Speak(Console.Text.Substring(xf.Location.position + xf.Location.top + xf.Location.length, 80 - (xf.Location.left + xf.Location.length)).Trim().Replace("|", "")); } } } break; } ; }