示例#1
0
        private void _runner(object sender)
        {
            int index   = (int)(sender);
            var comm    = new ClientComm(clientConfig.url);
            var runFunc = new RunFunc(index);

            runFunc.SetUI(setRichText);
            runFunc.SetIO(comList[index]);
            comm.send("get", MainForm.clientConfig.program);
            string json = comm.recv();

            Console.WriteLine(json);
            TaskConfig task = JsonConvert.DeserializeObject <TaskConfig>(json);

            initComPort(index);
            foreach (Logic logic in task.logic_list)
            {
                MethodInfo logicFunc = runFunc.GetType().GetMethod(logic.func);
                if (!(bool)(logicFunc.Invoke(runFunc, new object[] { logic })))
                {
                    break;
                }
            }
        }
 void Start()
 {
     FSM.addState(init, null);
     FSM.addState(run, init);
     FSM.addState(end, null);
     init_func += randomInitFunction;
     run_func += RunControll;
     InvokeNextState();
 }