Ejemplo n.º 1
0
 public override void WriteProgram(Work w)
 {
     if (w.TaskFinished)
     {
         w.SetState(new RestState());
         w.WriteProgram();
     }
     else
     {
         if (w.Hour < 21)
         {
             Console.WriteLine("当前时间:{0}点 加班哦,疲累之极", w.Hour);
         }
         else
         {
             w.SetState(new SleepingState());
             w.WriteProgram();
         }
     }
 }
Ejemplo n.º 2
0
 public override void WriteProgram(Work w)
 {
     if (w.Hour < 13)
     {
         Console.WriteLine("当前时间:{0}点 饿了,午饭;犯困,午休", w.Hour);
     }
     else
     {
         w.SetState(new AfterNoonState());
         w.WriteProgram();
     }
 }
Ejemplo n.º 3
0
 public override void WriteProgram(Work w)
 {
     if (w.Hour < 12)
     {
         Console.WriteLine("当前时间:{0}点 上午工作,精神百倍", w.Hour);
     }
     else
     {
         w.SetState(new NoonState());
         w.WriteProgram();
     }
 }
Ejemplo n.º 4
0
 public override void WriteProgram(Work w)
 {
     if (w.Hour < 17)
     {
         Console.WriteLine("当前时间:{0}点 下午状态还不错,继续努力", w.Hour);
     }
     else
     {
         w.SetState(new EveningState());
         w.WriteProgram();
     }
 }