Esempio n. 1
0
        private void MessagehubClient_reciveP2pMessage(string str)
        {
            try
            {
                str = str.Replace("\\", "");
                str = str.Remove(0, 1);
                str = str.Remove(str.Length - 1, 1);

                if (str.Contains("commandCode"))
                {
                    LaneSimulator.Model.Domain.Command com = JsonConvert.DeserializeObject <LaneSimulator.Model.Domain.Command>(str);
                    commandExecutor.resolveCommand(com, workingJobQueue, lane);//通知指令处理器处理指令
                }
                else
                {
                    string   truestr = JsonConvert.SerializeObject(workingJobQueue);
                    string   newstr  = JsonConvert.SerializeObject(workingJobQueue);
                    JobQueue queue   = JsonConvert.DeserializeObject <JobQueue>(str);
                    updateJobQueue(queue);
                }
            }
            catch (Exception ex)
            {
                AppendLog("reciveP2pMessage", 3, "接收到点对点数据" + str + "-" + "出现错误" + ex.ToString());
            }
        }
Esempio n. 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     CommandExecutor.RESULT_API_URL = textBox1.Text;
     LaneSimulator.Model.Domain.Command com = JsonConvert.DeserializeObject <LaneSimulator.Model.Domain.Command>(File.ReadAllText(Application.StartupPath + "/conf/command.json"));
     messagehubClient.sendP2pMessge(new MessageHub.Model.Message.MessageP2p(textBoxLaneCode.Text, JsonConvert.SerializeObject(com)));
 }