Beispiel #1
0
        void ReleaseDesignerOutlets()
        {
            if (AddButton != null)
            {
                AddButton.Dispose();
                AddButton = null;
            }

            if (InputFieldA != null)
            {
                InputFieldA.Dispose();
                InputFieldA = null;
            }

            if (InputFieldB != null)
            {
                InputFieldB.Dispose();
                InputFieldB = null;
            }

            if (MultiplyButton != null)
            {
                MultiplyButton.Dispose();
                MultiplyButton = null;
            }

            if (OutputField != null)
            {
                OutputField.Dispose();
                OutputField = null;
            }
        }
Beispiel #2
0
        void ReleaseDesignerOutlets()
        {
            if (addButton != null)
            {
                addButton.Dispose();
                addButton = null;
            }

            if (answerLabel != null)
            {
                answerLabel.Dispose();
                answerLabel = null;
            }

            if (DivideButton != null)
            {
                DivideButton.Dispose();
                DivideButton = null;
            }

            if (MultiplyButton != null)
            {
                MultiplyButton.Dispose();
                MultiplyButton = null;
            }

            if (SubtractButton != null)
            {
                SubtractButton.Dispose();
                SubtractButton = null;
            }

            if (text1 != null)
            {
                text1.Dispose();
                text1 = null;
            }

            if (text2 != null)
            {
                text2.Dispose();
                text2 = null;
            }
        }
Beispiel #3
0
        // Calculator_KeyPress: Checks for user input through KeyPresses and performs
        // the corresponding Click-event for the appropriate button.
        // Pre: -
        // Post: The KeyPress-event has been handled and, if there's a match, the appropriate
        // buttons Click-event has been fired.
        private void Calculator_KeyPress(object sender, KeyPressEventArgs e)
        {
            switch (e.KeyChar)
            {
            case '1': OneButton.PerformClick(); break;

            case '2': TwoButton.PerformClick(); break;

            case '3': ThreeButton.PerformClick(); break;

            case '4': FourButton.PerformClick(); break;

            case '5': FiveButton.PerformClick(); break;

            case '6': SixButton.PerformClick(); break;

            case '7': SevenButton.PerformClick(); break;

            case '8': EightButton.PerformClick(); break;

            case '9': NineButton.PerformClick(); break;

            case '0': ZeroButton.PerformClick(); break;

            case '/': DivideButton.PerformClick(); break;

            case '*': MultiplyButton.PerformClick(); break;

            case '-': SubtractButton.PerformClick(); break;

            case '+': AddButton.PerformClick(); break;

            case ',': CommaButton.PerformClick(); break;

            case 'C': ClearButton.PerformClick(); break;

            case 'c': ClearButton.PerformClick(); break;
            }
            e.Handled = true;
        }
        void ReleaseDesignerOutlets()
        {
            if (AboutButton != null)
            {
                AboutButton.Dispose();
                AboutButton = null;
            }

            if (AdditionButton != null)
            {
                AdditionButton.Dispose();
                AdditionButton = null;
            }

            if (ClearButton != null)
            {
                ClearButton.Dispose();
                ClearButton = null;
            }

            if (DisplayLabel != null)
            {
                DisplayLabel.Dispose();
                DisplayLabel = null;
            }

            if (DivisionButton != null)
            {
                DivisionButton.Dispose();
                DivisionButton = null;
            }

            if (EightButton != null)
            {
                EightButton.Dispose();
                EightButton = null;
            }

            if (EqualsButton != null)
            {
                EqualsButton.Dispose();
                EqualsButton = null;
            }

            if (FiveButton != null)
            {
                FiveButton.Dispose();
                FiveButton = null;
            }

            if (FourButton != null)
            {
                FourButton.Dispose();
                FourButton = null;
            }

            if (historyCalcSwipeGesture != null)
            {
                historyCalcSwipeGesture.Dispose();
                historyCalcSwipeGesture = null;
            }

            if (MultiplyButton != null)
            {
                MultiplyButton.Dispose();
                MultiplyButton = null;
            }

            if (NineButton != null)
            {
                NineButton.Dispose();
                NineButton = null;
            }

            if (OneButton != null)
            {
                OneButton.Dispose();
                OneButton = null;
            }

            if (SevenButton != null)
            {
                SevenButton.Dispose();
                SevenButton = null;
            }

            if (SixButton != null)
            {
                SixButton.Dispose();
                SixButton = null;
            }

            if (SubtractButton != null)
            {
                SubtractButton.Dispose();
                SubtractButton = null;
            }

            if (SymbolLabel != null)
            {
                SymbolLabel.Dispose();
                SymbolLabel = null;
            }

            if (ThreeButton != null)
            {
                ThreeButton.Dispose();
                ThreeButton = null;
            }

            if (TwoButton != null)
            {
                TwoButton.Dispose();
                TwoButton = null;
            }

            if (ZeroButton != null)
            {
                ZeroButton.Dispose();
                ZeroButton = null;
            }
        }
Beispiel #5
0
 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));
     }
 }
Beispiel #6
0
        void ReleaseDesignerOutlets()
        {
            if (CalculateButton != null)
            {
                CalculateButton.Dispose();
                CalculateButton = null;
            }

            if (DivideButton != null)
            {
                DivideButton.Dispose();
                DivideButton = null;
            }

            if (EightButton != null)
            {
                EightButton.Dispose();
                EightButton = null;
            }

            if (FiveButton != null)
            {
                FiveButton.Dispose();
                FiveButton = null;
            }

            if (FourButton != null)
            {
                FourButton.Dispose();
                FourButton = null;
            }

            if (MinusButton != null)
            {
                MinusButton.Dispose();
                MinusButton = null;
            }

            if (MultiplyButton != null)
            {
                MultiplyButton.Dispose();
                MultiplyButton = null;
            }

            if (NineButton != null)
            {
                NineButton.Dispose();
                NineButton = null;
            }

            if (OneButton != null)
            {
                OneButton.Dispose();
                OneButton = null;
            }

            if (PlusButton != null)
            {
                PlusButton.Dispose();
                PlusButton = null;
            }

            if (ResultBox != null)
            {
                ResultBox.Dispose();
                ResultBox = null;
            }

            if (SevenButton != null)
            {
                SevenButton.Dispose();
                SevenButton = null;
            }

            if (SixButton != null)
            {
                SixButton.Dispose();
                SixButton = null;
            }

            if (ThreeButton != null)
            {
                ThreeButton.Dispose();
                ThreeButton = null;
            }

            if (TwoButton != null)
            {
                TwoButton.Dispose();
                TwoButton = null;
            }

            if (ZeroButton != null)
            {
                ZeroButton.Dispose();
                ZeroButton = null;
            }
        }