//OFF /************************************************************* * Obsługa przycisków *************************************************************/ private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.D1 || e.Key == Key.NumPad1) { One.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D2 || e.Key == Key.NumPad2) { Two.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D3 || e.Key == Key.NumPad3) { Three.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D4 || e.Key == Key.NumPad4) { Four.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D5 || e.Key == Key.NumPad5) { Five.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D6 || e.Key == Key.NumPad6) { Six.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D7 || e.Key == Key.NumPad7) { Seven.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D8 || e.Key == Key.NumPad8) { if (Keyboard.IsKeyDown(Key.LeftShift)) { Star.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else { Eight.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } } else if (e.Key == Key.D9 || e.Key == Key.NumPad9) { Nine.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.D0 || e.Key == Key.NumPad0) { Zero.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } /**********************************************************/ /*else if (e.Key == Key.Enter) * { * Equals.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); * }*/ else if (e.Key == Key.OemComma || e.Key == Key.OemPeriod || e.Key == Key.Decimal) { Dot.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.OemMinus || e.Key == Key.Subtract) { Minus.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.OemPlus || e.Key == Key.Add) { Plus.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Delete) { AC.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Back) { C.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Divide || e.Key == Key.OemBackslash || e.Key == Key.OemQuestion || e.Key == Key.Oem5) { Slash.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Multiply) { Star.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.P) { MP.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Escape) { Application.Current.Shutdown(); } Console.WriteLine(e.Key.ToString()); }