Exemple #1
0
 public void Undo()
 {
     if (prevSpeed == CeilingFan.High)
     {
         ceilingFan.high();
     }
     if (prevSpeed == CeilingFan.Medium)
     {
         ceilingFan.medium();
     }
     if (prevSpeed == CeilingFan.Low)
     {
         ceilingFan.low();
     }
     if (prevSpeed == CeilingFan.Off)
     {
         ceilingFan.off();
     }
 }
Exemple #2
0
 public void Execute()
 {
     //执行前先记录速度,方便撤销
     prevSpeed = ceilingFan.GetSpeed();
     ceilingFan.low();
 }