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; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); _calculatorPopup = (Popup)GetTemplateChild("PART_CalculatorPopup"); _calculatorPopup.Opened += CalculatorPopup_Opened; _calculator = (Calculator)GetTemplateChild("PART_Calculator"); }