private void SendMessage(EventArgs x) { if (Manager.UseGuide && Guide.IsVisible) return; KeyEventArgs k = new KeyEventArgs(); GamePadEventArgs g = new GamePadEventArgs(PlayerIndex.One); if (x is KeyEventArgs) k = x as KeyEventArgs; else if (x is GamePadEventArgs) g = x as GamePadEventArgs; ConsoleChannel ch = channels[cmbMain.Text]; if (ch != null) { txtMain.TextColor = ch.Color; string message = txtMain.Text; if ((k.Key == Microsoft.Xna.Framework.Input.Keys.Enter || g.Button == GamePadActions.Press) && message != null && message != "") { x.Handled = true; ConsoleMessageEventArgs me = new ConsoleMessageEventArgs(new ConsoleMessage(message, ch.Index)); OnMessageSent(me); buffer.Add(new ConsoleMessage(me.Message.Text, me.Message.Channel)); txtMain.Text = ""; ClientArea.Invalidate(); CalcScrolling(); } } }
void Input_KeyDown(object sender, KeyEventArgs e) { if (Visible && (Manager.FocusedControl != null && Manager.FocusedControl.Root == this) && e.Key == Microsoft.Xna.Framework.Input.Keys.Escape) { //Close(ModalResult.Cancel); } }
void txtMain_KeyDown(object sender, KeyEventArgs e) { SendMessage(e); }
void btnSlider_KeyPress(object sender, KeyEventArgs e) { if (e.Key == Microsoft.Xna.Framework.Input.Keys.Left || e.Key == Microsoft.Xna.Framework.Input.Keys.Down) Value -= stepSize; else if (e.Key == Microsoft.Xna.Framework.Input.Keys.Right || e.Key == Microsoft.Xna.Framework.Input.Keys.Up) Value += stepSize; else if (e.Key == Microsoft.Xna.Framework.Input.Keys.PageDown) Value -= pageSize; else if (e.Key == Microsoft.Xna.Framework.Input.Keys.PageUp) Value += pageSize; else if (e.Key == Microsoft.Xna.Framework.Input.Keys.Home) Value = 0; else if (e.Key == Microsoft.Xna.Framework.Input.Keys.End) Value = Range; }