示例#1
0
        //The reason this one takes multiple arguments is so it can field any relevant argument this prac can give.
        //It deviates from the one specified slightly but I couldn't think of how to do this without args as was shown in the handout. Discuss?
        private void OnUpdateEvent(NumericUpDown nud, ProgressBar progBar, TrackBar trackBar)
        {
            //Create a new custom event arg
               CustomEventArgs ce = new CustomEventArgs(nud, progBar, trackBar);

               //A bit of error-prevention as discussed in class
               if (progressEvent != null)
               {
               progressEvent(this, ce);
               }
        }
 //Abstract method that all child observers will provide implementation for
 public abstract void ProgUpdateHandler(object subject, CustomEventArgs ce);
示例#3
0
 public override void ProgUpdateHandler(object subject, CustomEventArgs ce)
 {
     ce.trackBar.Value++;
 }
示例#4
0
 public override void ProgUpdateHandler(object subject, CustomEventArgs ce)
 {
     ce.nud.UpButton();
     ce.nud.Refresh();
 }