Пример #1
0
        private void Init()
        {
            // Create MVP architecture
            _numberPad           = new NumberPad(_mainWindow);
            _mathExpressionModel = new MathExpressionModel();
            _calculatorPresenter = new CalculatorPresenter(_mathExpressionModel);
            _expressionView      = new FTextBlock(_mainWindow.txt_blk_expression);

            // Presenter is listening on to the number pad view
            _numberPad.SetButtonPressedCallback(_calculatorPresenter.ExpressionButtonPressed);
            // ExpressionView is listening to the changes on the model
            _mathExpressionModel.ExpressionPropertyChanged.AddListener(_expressionView.OnTextUpdated);

            // Update all the listeners with the latest values
            _mathExpressionModel.RefreshValues();
        }
Пример #2
0
 public CalculatorPresenter(MathExpressionModel model)
 {
     _mathExpressionModel = model;
 }