Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ClockSetup clockSetup = new ClockSetup();

            // Setup starts in 'year' state
            clockSetup.RotateKnobRight();
            clockSetup.PushKnob(); // year should be 1 on from current

            // Setup should now be in 'month' state
            clockSetup.RotateKnobRight();
            clockSetup.RotateKnobRight();
            clockSetup.PushKnob(); // month should be 2 on from current

            // Setup should now be in 'day' state
            clockSetup.RotateKnobRight();
            clockSetup.RotateKnobRight();
            clockSetup.RotateKnobRight();
            clockSetup.PushKnob(); // day should be 3 on from current

            // Setup should now be in 'hour' state
            clockSetup.RotateKnobLeft();
            clockSetup.RotateKnobLeft();
            clockSetup.PushKnob(); // hour should be 2 less than current

            // Setup should now be in 'minute' state
            clockSetup.RotateKnobRight();
            clockSetup.PushKnob(); // minute should be 1 on than current

            // Setup should now be in 'finished' state
            clockSetup.PushKnob(); // to display selected date

            Console.Read();
        }
 public MinuteSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     minute          = DateTime.Now.Minute;
 }
Ejemplo n.º 3
0
 public HourSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     hour            = DateTime.Now.Hour;
 }
Ejemplo n.º 4
0
 public DaySetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     day             = DateTime.Now.Day;
 }
Ejemplo n.º 5
0
 public MonthSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     month           = DateTime.Now.Month;
 }
Ejemplo n.º 6
0
 public YearSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     year            = DateTime.Now.Year;
 }
 public FinishedSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
 }