public virtual void Execute(EventArgs a) { //Clock Clock = Clock.Instance; ClockEventArgs args = (ClockEventArgs)a; Clock.IncDec(args.Hour, args.Minute, args.Second); // set arguments for undo/redo args.Hour *= -1; args.Minute *= -1; args.Second *= -1; }
public void IncClick(object sender, EventArgs e) { // variables ClockEventArgs args = new ClockEventArgs(); // set arguments args.Hour = Window.Hours.Checked ? 1 : 0; args.Minute = Window.Minutes.Checked ? 1 : 0; args.Second = Window.Seconds.Checked ? 1 : 0; // call command mCommands["incdec"].Execute(args); // set undo/redo mUndoBuffer.Add(new Tuple <ICommand, EventArgs>(mCommands["incdec"], args)); mRedo = null; }
public virtual void Execute(EventArgs a) { // variables //Clock clock = Clock.Instance; int h = Clock.Hour; int m = Clock.Minute; int s = Clock.Second; // set clock ClockEventArgs args = (ClockEventArgs)a; Clock.Set(args.Hour, args.Minute, args.Second); // set args for undo/redo args.Hour = h; args.Minute = m; args.Second = s; }
public void SetClick(object sender, EventArgs e) { // variables ClockEventArgs args = new ClockEventArgs(); // set argument args.Hour = (int)Window.SetHours.Value; args.Minute = (int)Window.SetMinutes.Value; args.Second = (int)Window.SetSeconds.Value; // reset values Window.SetHours.Value = Window.SetMinutes.Value = Window.SetSeconds.Value = -1; // call command mCommands["set"].Execute(args); // set undo/redo mUndoBuffer.Add(new Tuple <ICommand, EventArgs>(mCommands["set"], args)); mRedo = null; }