public Form1() { InitializeComponent(); // Instantiate them subject = new ProgressEventSubject(); pbO = new ProgressBarObserver(subject, progressBar1); spO = new SpinBoxObserver(subject, numericUpDown1, this); tbO = new TrackBarObserver(subject, trackBar1); }
public Form1() { InitializeComponent(); // Create instance of subject first so that observers can subscribe subject = new ProgressSubject(); // Instantiate our observers once subject exists progressBarObserver = new ProgressBarObserver(subject, progressBar1); trackBarObserver = new TrackBarObserver(subject, trackBar1); upDownObserver = new UpDownObserver(subject, numericUpDown1, this); }