private void ContactContextMenuItem_Click(object sender, RoutedEventArgs e) { Log.WriteLine(sender.GetType().Name); if (_openCsvFile) { return; } var item = (sender as MenuItem)?.DataContext as Item; if (item != null && item.Id != null) { MinusButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); e.Handled = true; } }
private void ContactList_KeyDown(object sender, KeyEventArgs e) { e.Handled = false; if (object.ReferenceEquals(sender, ContactList)) { if (e.IsDown && e.Key == Key.Tab) { this._isItemClick = true; } else if (e.IsDown && e.Key == Key.Back && !_openCsvFile) { MinusButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.NumPad1) { button1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad2) { button2.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad3) { button3.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad4) { button4.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad5) { button5.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad6) { button6.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad7) { button7.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad8) { button8.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad9) { button9.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad0) { button0.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Add) { PlusButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Subtract) { MinusButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Divide) { DivideButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Multiply) { MultiplyButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.OemComma || e.Key == Key.Decimal) { buttonComma.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Back) { ClearEverything.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.PageDown || e.Key == Key.Enter) { RunButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } }