Exemple #1
0
        static void Main()
        {
            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();
        }
Exemple #2
0
        static void Main()
        {
            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 MonthSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     month           = DateTime.Now.Month;
 }
 public FinishedSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
 }
 public DaySetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     day             = DateTime.Now.Day;
 }
 public FinishedSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
 }
 public MinuteSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     minute = DateTime.Now.Minute;
 }
Exemple #8
0
 public HourSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     hour            = DateTime.Now.Hour;
 }
 public MonthSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     month = DateTime.Now.Month;
 }
 public YearSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     year            = DateTime.Now.Year;
 }
 public HourSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     hour = DateTime.Now.Hour;
 }
Exemple #12
0
 public DaySetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     day = DateTime.Now.Day;
 }
 public MinuteSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     minute          = DateTime.Now.Minute;
 }
 public YearSetupState(ClockSetup clockSetup)
 {
     this.clockSetup = clockSetup;
     year = DateTime.Now.Year;
 }