Beispiel #1
0
        private void reflashPrograme()
        {
            programeSelectBox.Items.Clear();
            comm.send("reflash", "");
            JsonReader reader = new JsonTextReader(new StringReader(comm.recv()));

            while (reader.Read())
            {
                if (reader.TokenType == JsonToken.String)
                {
                    programeSelectBox.Items.Add(reader.Value);
                }
                else if (reader.TokenType == JsonToken.EndArray)
                {
                    break;
                }
            }
        }
Beispiel #2
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;
                }
            }
        }