Пример #1
0
 public CalculatorController(ICalculatorView view)
 {
     this.view = view;
     this.view.NumberPressed   += HandleNumberPressed;
     this.view.OperatorPressed += HandleOperatorPressed;
     this.view.ModifierPressed += HandleModifierPressed;
 }
Пример #2
0
 public CalculatorPresenter(ICalculatorView view,
                            ICalculatorRepository repo,
                            IHttpRepository httpRepo,
                            ILogger logger,
                            string ServiceUrl,
                            bool IsDev)
 {
     _view              = view;
     _calRepo           = repo;
     _view.SubmitClick += SubmitClick;
     _httpRepo          = httpRepo;
     _logger            = logger;
     _serviceUrl        = ServiceUrl;
     _isDev             = IsDev;
 }
 public CalculatorPresenter(ICalculatorView calculatorView, IMessageBoxDisplayService messageBoxDisplayService, ISaveHistoryService saveHistoryService, ICalculatorEngine businessLogicObject)
 {
     _calculatorView                     = calculatorView;
     _messageBoxDisplayService           = messageBoxDisplayService;
     _saveHistoryService                 = saveHistoryService;
     _calculatorEngine                   = businessLogicObject;
     calculatorView.DigitClicked        += OnDigitClick;
     calculatorView.OperatorClicked     += OnOperatorClick;
     calculatorView.ResultClicked       += OnResultClick;
     calculatorView.SaveHistoryClicked  += OnSaveHistoryClick;
     calculatorView.MemoryClicked       += OnMemoryClick;
     calculatorView.ClearAllClicked     += OnClearAllClick;
     calculatorView.ClearEntryClicked   += OnClearEntryClick;
     calculatorView.EraseHistoryClicked += OnEraseHistory;
 }
Пример #4
0
        /// <summary>
        /// Create a new calculator controller
        /// </summary>
        /// <param name="model">The model to use with the controller</param>
        /// <param name="view">The view to use with the controller</param>
        public CalculatorController(ICalculatorModel model, ICalculatorView view)
        {
            Model = model;
            View  = view;

            //listen View key pressed
            View.OnKeyPressed += HandleKeyPressed;

            //listen Model operands & operation
            Model.OnOperandChanged   += HandleOperandChanged;
            Model.OnOperationChanged += HandleOperationChanged;
            Model.OnResultComputed   += HandleResultComputed;
            Model.OnCleared          += HandleModelCleared;

            //Clear model at beginning
            Model.Clear();
        }
Пример #5
0
        public CalculatorPresenter(
            ICalculatorView calculatorView,
            IEquationEvaluator equationParser
            )
        {
            this.calculatorView = calculatorView;
            this.equationParser = equationParser;

            this.calculatorView.NumberPressed       += this.OnNumberPressed;
            this.calculatorView.DecimalPressed      += this.OnDecimalPointPressed;
            this.calculatorView.MulitplyPressed     += this.OnMulitplyPressed;
            this.calculatorView.DividePressed       += this.OnDividePressed;
            this.calculatorView.AddPressed          += this.OnAddPressed;
            this.calculatorView.SubtractPressed     += this.OnSubtractPressed;
            this.calculatorView.EqualsPressed       += this.OnEqualsPressed;
            this.calculatorView.ClearPressed        += this.OnClearPressed;
            this.calculatorView.OpenBracketPressed  += this.OnOpenBracketPressed;
            this.calculatorView.CloseBracketPressed += this.OnCloseBracketPressed;
        }
 public CalculatorPresenter(ICalculatorView view)
 {
     this.view = view;
 }
Пример #7
0
 public FileCalculator(ICalculatorView view)
 {
     _view = view;
 }
Пример #8
0
 public ConsoleCalculator(ICalculatorView view)
 {
     _view = view;
 }
Пример #9
0
 public CalculatorPresenter(ICalculatorView view)
 {
     this.view = view;
 }
 public Presenter(ICalculatorView view)
 {
     this._View = view;
 }
Пример #11
0
 public StringCalculator(ICalculatorView view)
 {
     View = view;
 }