public void AddCommand(RouterCommand r) { lock (commands) { commands.Add(r); finalPosition = r.FinalPosition(); } }
void RobotReady(object o, EventArgs e) { lock (commands) { if (commands.Count > 0) { RouterCommand c = commands[0]; Console.WriteLine("Executing Command {0}", commands.Count); commands.RemoveAt(0); c.Execute(device); } else { finalPosition = device.GetPosition(); } } }
public void AddRouterCommands(RouterCommand[] router_commands) { lock (commands) { this.commands.AddRange(router_commands); Console.WriteLine("Now Has " + commands.Count + " Router Commands"); } }