Пример #1
0
        //从页面得到数据了,解析并发送到LED
        void SendToLED()
        {
            if (ConstructFormatedString())
            {
                int initRes = 0;

                if (bInitSuccess)
                {
                    //{"TYPE":"LED","IP" : "192.168.1.100", "PORT":"1023" , "LEDDATA": ["32*32&&黄&&欢迎公司领导检查指导!","16*16&&黄&&Hello!"] }

                    ledCom.IP      = IPdata["IP"];
                    ledCom.UDPPort = Convert.ToUInt32(IPdata["PORT"]);

                    initRes = ledCom.SendTextToLED() == 0 ? 1 : 0;

                    ledCom.CleanFormatedContentText();

                    if (0 == initRes)
                    {
                        LogHelper.WriteWithMethod("发送到LED失败!");
                    }

                    string temp = string.Format("\"success\":\"{0}\"", initRes.ToString());
                    //string.Format("{\"TYPE\":\"LED\",\"success\":\"{0}\"}", initRes.ToString())
                    string res = "{\"TYPE\":\"LED\"," + temp + "}";


                    tcpListenerServer.SendMessageToClient(res);
                    //{"TYPE":"LED","success":"{0}"}
                }

                ledDataCollection.Clear();
            }
        }
Пример #2
0
        private void SendText_Click(object sender, RoutedEventArgs e)
        {
            bool initRes = false;

            if (bInitSuccess)
            {
                testLedCom.IP      = ledData.IP;
                testLedCom.UDPPort = Convert.ToUInt32(ledData.LEDPort);

                initRes = testLedCom.SendTextToLED() == 0 ?true:false;

                testLedCom.CleanFormatedContentText();

                if (!initRes)
                {
                    MessageBox.Show(this, "发送到LED失败!");
                }

                BtnAddCpntent.IsEnabled  = true;
                BtnSendContent.IsEnabled = false;
            }
        }