Example #1
0
        public Form1()
        {
            InitializeComponent();

            speedMonitorSubject = new SpeedMonitorSubject();    // must create SpeedMonitorSubject first - we need to pass
                                                                // it in when we call an observer's constructor
            rpmObserver = new RPMObserver(lblRPM, speedMonitorSubject);
            caloriesObserver = new CaloriesObserver(lblCaloriesPerHour, speedMonitorSubject);
            kmsPerHourObserver = new KMsPerHourObserver(lblKMPerHour, speedMonitorSubject);
        }
Example #2
0
        public Form1()
        {
            InitializeComponent();

            speedMonitorSubject = new SpeedMonitorSubject();    // must create SpeedMonitorSubject first - we need to pass
                                                                // it in when we call an observer's constructor
            rpmObserver        = new RPMObserver(lblRPM, speedMonitorSubject);
            caloriesObserver   = new CaloriesObserver(lblCaloriesPerHour, speedMonitorSubject);
            kmsPerHourObserver = new KMsPerHourObserver(lblKMPerHour, speedMonitorSubject);
        }