//Ctor public ProgressBaseObserver(ProgressSubject subject) { this.subject = subject; //Create a handler and bind it to the specified method EventHandler<CustomEventArgs> handler = new EventHandler<CustomEventArgs>(ProgUpdateHandler); //Bind the handler to a subject subject.progressEvent += handler; }
public Form1() { InitializeComponent(); //init new observers slowWorker = new ProgressSubject(); //intantiate these new observers and pass them the subject so they know who to 'listen' on. progBarObs = new ProgBarObserver(slowWorker); trackBarObs = new TrackBarObserver(slowWorker); nudObs = new NUDObserver(slowWorker); }
//ctor public TrackBarObserver(ProgressSubject subject) : base(subject) { }
//Blank ctor public ProgBarObserver(ProgressSubject subject) : base(subject) { }
//ctor public NUDObserver(ProgressSubject subject) : base(subject) { }