예제 #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

              if( _calculatorPopup != null )
            _calculatorPopup.Opened -= CalculatorPopup_Opened;

              _calculatorPopup = GetTemplateChild( PART_CalculatorPopup ) as Popup;

              if( _calculatorPopup != null )
            _calculatorPopup.Opened += CalculatorPopup_Opened;

              if( _calculator != null )
            _calculator.ValueChanged -= OnCalculatorValueChanged;

              _calculator = GetTemplateChild( PART_Calculator ) as Calculator;

              if( _calculator != null )
            _calculator.ValueChanged += OnCalculatorValueChanged;
        }
예제 #2
0
        private void ProcessMemoryKey( Calculator.CalculatorButtonType buttonType )
        {
            decimal currentValue = CalculatorUtilities.ParseDecimal( DisplayText );

              switch( buttonType )
              {
            case Calculator.CalculatorButtonType.MAdd:
              Memory += currentValue;
              break;
            case Calculator.CalculatorButtonType.MC:
              Memory = decimal.Zero;
              break;
            case Calculator.CalculatorButtonType.MR:
              DisplayText = Memory.ToString();
              break;
            case Calculator.CalculatorButtonType.MS:
              Memory = currentValue;
              break;
            case Calculator.CalculatorButtonType.MSub:
              Memory -= currentValue;
              break;
            default:
              break;
              }

              _showNewNumber = true;
        }