static void OnStatusChanged(object sender, CONTROLLER_STATE state) { MPController mp; if (sender is MPController && ModulesIsReady) { mp = sender as MPController; CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, mp.Name + " on changed state: " + state); //if (CommandList.Count == 0) //{ // mp.state = CONTROLLER_STATE.END; //} if (state == CONTROLLER_STATE.READY && CommandList.Count != 0) { mp.SetTask(CommandList.Dequeue()); } } else { Console.WriteLine("wrong params"); } }