Esempio n. 1
0
 public Form1()
 {
     InitializeComponent();
     bikeWorker = new SubjectBicycle();
     rpmDisplay = new RPMObserver(bikeWorker, lbRPM);
     calDisplay = new CalPerHourObserver(bikeWorker, lbCal);
     kmhDisplay = new KMHObserver(bikeWorker, lbkmsh);
 }
Esempio n. 2
0
        //Constructor, passed in display label and subject.
        public BicycleObserver(SubjectBicycle bikesubject, Label displayLabel)
        {
            //allocate space in memory
            currentRPM = 0;
            currentComputedValue = 0;
            this.bikesubject = bikesubject;
            this.displayLabel = displayLabel;

            // this addes itself to the subjects observerlist.
            bikesubject.AddObserver(this);
        }
Esempio n. 3
0
 //Constructor
 public CalPerHourObserver(SubjectBicycle bikeSubject, Label displayLabel)
     : base(bikeSubject, displayLabel)
 {
 }
Esempio n. 4
0
 //Constructor
 public KMHObserver(SubjectBicycle bikeSubject, Label displayLabel)
     : base(bikeSubject, displayLabel)
 {
 }