//sets subject, button, random object
        public Observer(SubjectWithEvent subject)
        {
            this.subject = subject;

            //adds delegate instance containing "DoStuff" to the buttons click event
            subject.OnProgressUpdateEvent += new System.EventHandler(DoStuff);
        }
        public SpinBoxObserver(SubjectWithEvent subject, NumericUpDown spinBox, Form form)
            : base(subject)
        {
            this.spinBox = spinBox;

            //sets form
            formControl = form;
        }
        public Form1()
        {
            InitializeComponent();

            progressSubject = new SubjectWithEvent();

            //creates observers - spinbox takes in form control
            obsSpin = new SpinBoxObserver(progressSubject, spinBox, this);
            obsProgress = new ProgressBarObserver(progressSubject, progressBar);
            obsTrack = new TrackBarObserver(progressSubject, trackBar);
        }
 public TrackBarObserver(SubjectWithEvent subject, TrackBar admiralTrackBar)
     : base(subject)
 {
     trackBar = admiralTrackBar;
 }
 public ProgressBarObserver(SubjectWithEvent subject, ProgressBar pb)
     : base(subject)
 {
     progressBar = pb;
 }