private void EnableChange(object sender, RoutedEventArgs e) { FirstTextBoxEnableState = (bool)EnableCheckBox.IsChecked; SecondTextBoxEnableState = (bool)EnableCheckBox.IsChecked; ThirdTextBoxEnableState = (bool)EnableCheckBox.IsChecked; FirstTextBox.Clear(); SecondTextBox.Clear(); ThirdTextBox.Clear(); }
public void ControlKeys(KeyEventArgs e) { string symbol = ""; Dictionary <Keys, char> keys = new Dictionary <Keys, char> { [Keys.D0] = '0', [Keys.D1] = '1', [Keys.D2] = '2', [Keys.D3] = '3', [Keys.D4] = '4', [Keys.D5] = '5', [Keys.D6] = '6', [Keys.D7] = '7', [Keys.D8] = '8', [Keys.D9] = '9', [Keys.A] = 'A', [Keys.B] = 'B', [Keys.C] = 'C', [Keys.D] = 'D', [Keys.E] = 'E', [Keys.F] = 'F', [Keys.G] = 'G', [Keys.H] = 'H', [Keys.I] = 'I', [Keys.J] = 'J', [Keys.K] = 'K', [Keys.L] = 'L', [Keys.M] = 'M', [Keys.N] = 'N', [Keys.O] = 'O', [Keys.P] = 'P', [Keys.Q] = 'Q', [Keys.R] = 'R', [Keys.S] = 'S', [Keys.T] = 'T', [Keys.U] = 'U', [Keys.V] = 'V', [Keys.W] = 'W', [Keys.X] = 'X', [Keys.Y] = 'Y', [Keys.Z] = 'Z' }; switch (e.KeyCode) { case Keys.Oemplus: InsertSymbol(ButtonPlus, null); break; case Keys.OemMinus: InsertSymbol(ButtonMinus, null); break; case Keys.Multiply: InsertSymbol(ButtonMultiple, null); break; case Keys.Divide: InsertSymbol(ButtonDevide, null); break; case Keys.Enter: EnterAnswer(ButtonAnswer, null); break; case Keys.PageUp: if (AnswerNumeric.Value != 36) { AnswerNumeric.Value++; } break; case Keys.PageDown: if (AnswerNumeric.Value != 2) { AnswerNumeric.Value--; } break; } if (e.Alt) { foreach (var i in keys.Keys) { if (e.KeyCode == i) { symbol = keys[i].ToString(); } } SecondTextBox.Text += symbol; if (e.KeyCode == Keys.Up && SecondNumeric.Value != 36) { SecondNumeric.Value++; } else if (e.KeyCode == Keys.Down && SecondNumeric.Value != 2) { SecondNumeric.Value--; } else if (e.KeyCode == Keys.Back && SecondTextBox.Text != "") { SecondTextBox.Text = SecondTextBox.Text.Substring(0, SecondTextBox.Text.Length - 1); } else if (e.KeyCode == Keys.Delete) { SecondTextBox.Clear(); } } else { foreach (var i in keys.Keys) { if (e.KeyCode == i) { symbol = keys[i].ToString(); } } FirstTextBox.Text += symbol; if (e.KeyCode == Keys.Up && FirstNumeric.Value != 36) { FirstNumeric.Value++; } else if (e.KeyCode == Keys.Down && FirstNumeric.Value != 2) { FirstNumeric.Value--; } else if (e.KeyCode == Keys.Back && FirstTextBox.Text != "") { FirstTextBox.Text = FirstTextBox.Text.Substring(0, FirstTextBox.Text.Length - 1); } else if (e.KeyCode == Keys.Delete) { FirstTextBox.Clear(); } } }