示例#1
0
 public void AddCommand(TimedCommand cmd)
 {
     if (commands.Count == 0)
     {
         commands.Add(cmd);
     }
     else
     {
         int pos;
         for (pos = 0; pos < commands.Count; pos++)
         {
             if (cmd.Time < commands[pos].Time)
             {
                 break;
             }
         }
         if (pos < commands.Count)
         {
             commands.Insert(pos, cmd);
         }
         else
         {
             commands.Add(cmd);
         }
     }
     showCommands();
 }
示例#2
0
 public void Run()
 {
     if (commands.Count == 0)
     {
         Console.WriteLine("Execution completed");
     }
     else
     {
         TimedCommand cmd = commands[0];
         commands.RemoveAt(0);
         cmd.Execute(this);
     }
 }