Ejemplo n.º 1
0
        public CalculatorForm()
        {
            InitializeComponent();
            calculation = new Calculation();

            /* Set up this form to be notified whenever the calculation is updated/changed. The
             * reason for using the observer pattern here is to avoid duplicated code updating the
             * screen in each button clicked method. */
            calculation.AddChangeObserver(this);

            /* Set up this form to be notified whenever an arithmetic exception occurs. See
             * IArithmeticExceptionObserver for the kinds of exceptions that can occurr and when
             * they occurr. */
            calculation.AddArithmeticExceptionObserver(this);
        }