private void LocalizedMessageBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { Button_1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); } if (e.Key == Key.Escape) { Close(); } }
private async Task ToggleSubButtons() { if (!_isShown) { Button_1.ScaleTo(1, 150, Easing.SpringOut); Button_1.FadeTo(1, 150, Easing.SpringOut); Button_1.TranslateTo(0, -70, 150, Easing.SpringOut); await Task.Delay(50); Button_2.ScaleTo(1, 150, Easing.SpringOut); Button_2.FadeTo(1, 150, Easing.SpringOut); Button_2.TranslateTo(-52.15, -52.15, 150, Easing.SpringOut); await Task.Delay(50); Button_3.ScaleTo(1, 150, Easing.SpringOut); Button_3.FadeTo(1, 150, Easing.SpringOut); Button_3.TranslateTo(-70, 0, 150, Easing.SpringOut); } else { Button_3.ScaleTo(0, 150, Easing.SpringOut); Button_3.FadeTo(0, 150, Easing.SpringOut); Button_3.TranslateTo(0, 0, 150, Easing.SpringOut); await Task.Delay(50); Button_2.ScaleTo(0, 150, Easing.SpringOut); Button_2.FadeTo(0, 150, Easing.SpringOut); Button_2.TranslateTo(0, 0, 150, Easing.SpringOut); await Task.Delay(50); Button_1.ScaleTo(0, 150, Easing.SpringOut); Button_1.FadeTo(0, 150, Easing.SpringOut); Button_1.TranslateTo(0, 0, 150, Easing.SpringOut); } _isShown = !_isShown; }
private void Form_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.NumPad0: Button_0.PerformClick(); break; case Keys.NumPad1: Button_1.PerformClick(); break; case Keys.NumPad2: Button_2.PerformClick(); break; case Keys.NumPad3: Button_3.PerformClick(); break; case Keys.NumPad4: Button_4.PerformClick(); break; case Keys.NumPad5: Button_5.PerformClick(); break; case Keys.NumPad6: Button_6.PerformClick(); break; case Keys.NumPad7: Button_7.PerformClick(); break; case Keys.NumPad8: Button_8.PerformClick(); break; case Keys.NumPad9: Button_9.PerformClick(); break; case Keys.Add: Button_Plus.PerformClick(); break; case Keys.Divide: Button_Divide.PerformClick(); break; case Keys.Multiply: Button_Multiply.PerformClick(); break; case Keys.Subtract: Button_Minus.PerformClick(); break; case Keys.Back: Button_CE.PerformClick(); break; case Keys.Decimal: Button_Dot.PerformClick(); break; case Keys.Enter: Button_Equal.PerformClick(); break; } }