private void msg_TextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { Send_Button.PerformClick(); } }
private void ExecuteMsg() { String input = ""; try { input = ConsoleInput.Text; if (!input.StartsWith("!")) { input = "!say " + input; } var CM = MainWindow.instance.CommandManager; WriteLine(input); if (CM.ExecuteCommand(input, Conn)) { ConsoleInput.Text = ""; Command cmd = Command.GetCommand(input); if (cmd != Command.GetCommand(Commands.NONE) && cmd != Command.GetCommand(Commands.ERROR)) { int len; if (cmd != Command.GetCommand(Commands.SAY)) { len = 0; } else { len = cmd.CommandString.Length; } CM.AddCommandToList(input.Substring(len, input.Length - len)); WriteLine("Command executed"); } else { WriteLine("Command executed but there was something wrong", Brushes.Yellow); } } else { WriteLine("Command not executed!", Brushes.Red); } } catch (Exception ex) { CDialogManager.ShowExceptionDialog(ex, "You are disconnected!"); Conn.Disconnect(); } Send_Button.SetResourceReference(Control.IsEnabledProperty, "Connected"); }