public frmMain()
        {
            InitializeComponent();

            //strMachineID = SoftReg.getMNum(); //为获取CPU ID失败,改用取随机数的MD5值

            strMachineID = Encrypt.GetMD5(strClientId);
            //-------------------------------测试环境写死-----------------------------------------
            //strMachineID = "aaabbbccc";
            //strClientId = "111222333";
            strDst = strMachineID + "_" + strClientId;
            //-------------------------------------------------------------------------------------

            strMQTT_TCP_Server_Topic = string.Format(strMQTT_TCP_Server_Topic_Format, strMachineID, strClientId);
            strMQTT_WEB_Server       = string.Format(strMQTT_WEB_Server_Format, strMachineID, strClientId);

            message_send = new MQTTMessage_Send();
            message_recv = new MQTTMessage_Recv();

            options = new QrCodeEncodingOptions
            {
                DisableECI   = true,
                CharacterSet = "UTF-8",
                Width        = picQRCodeURL.Width,
                Height       = picQRCodeURL.Height
            };
            writer         = new BarcodeWriter();
            writer.Format  = BarcodeFormat.QR_CODE;
            writer.Options = options;

            Bitmap bitmap = writer.Write(strMQTT_WEB_Server);

            picQRCodeURL.Image = bitmap;

            string strID          = string.Empty;
            string strHTTPReq     = string.Empty;
            string strCustAppName = string.Empty;
            string strCustLogoSRC = string.Empty;
            string strCustLogoURL = string.Empty;

            string strEXEName = Application.ExecutablePath.Substring(Application.ExecutablePath.ToString().LastIndexOf("\\") + 1).ToLower();



            AppCustSetting message_setting = new AppCustSetting();

            if (strEXEName.IndexOf("__") != 0)
            {
                strID      = "10000";
                strHTTPReq = HttpHelper.GetHTTPInfo(string.Format(str_APP_My_Setting_Format, strID), "utf-8", 2000);

                this.Text = strAPPTITLE + Application.ProductVersion.ToString();

                if (strHTTPReq.Trim() != "")
                {
                    message_setting = JsonHelper.DeserializeJsonToObject <AppCustSetting>(strHTTPReq);
                    lnkAD.Text      = message_setting.GlobalADText.ToString();
                    strADURL        = message_setting.GlobalADURL.ToString();
                    lnkAD.Visible   = (message_setting.HiddenAD.ToString().ToLower() != "true");
                }
            }
            else
            {
                //通过Internet获取自定义的名称
                int iBegin = strEXEName.IndexOf("__");
                int iEnd   = strEXEName.LastIndexOf(".");
                strID = strEXEName.Substring(iBegin + 2, iEnd - iBegin - 2);

                strHTTPReq = HttpHelper.GetHTTPInfo(string.Format(str_APP_My_Setting_Format, strID), "utf-8", 2000);

                if (strHTTPReq.Trim() != "")
                {
                    message_setting = JsonHelper.DeserializeJsonToObject <AppCustSetting>(strHTTPReq);

                    strCustAppName = message_setting.CustAppName.ToString();
                    strCustLogoSRC = message_setting.CustLogoSRC.ToString();
                    strCustLogoURL = message_setting.CustLogoURL.ToString();
                    lnkAD.Text     = message_setting.GlobalADText.ToString();
                    strADURL       = message_setting.GlobalADURL.ToString();
                    lnkAD.Visible  = (message_setting.HiddenAD.ToString().ToLower() != "true");

                    this.Text = strAPPTITLE + " - " + strCustAppName;
                }
                else
                {
                    this.Text = strAPPTITLE + Application.ProductVersion.ToString();
                }
            }

            try
            {
                MQTTProgram(strMQTT_TCP_Server, strMQTT_TCP_Server_Topic);
            }
            catch (Exception ex)
            {
                MessageBox.Show("好像遇到点麻烦事了,亲,是不是你这个电脑还不能够联上互联网呀?");
            }



            // wsPPTControl.Opened += new EventHandler(wsPPTControl_Opened);
            // wsPPTControl.Open();


            //websocket.Error += new EventHandler<ErrorEventArgs>(websocket_Error);
            //websocket.Closed += new EventHandler(websocket_Closed);
            //websocket.MessageReceived += new EventHandler(websocket_MessageReceived);
        }
        bool client_PublishArrived(object sender, PublishArrivedArgs e)
        {
            /*
             * Console.WriteLine("Received Message");
             * Console.WriteLine("Topic: " + e.Topic);
             * Console.WriteLine("Payload: " + e.Payload);
             * Console.WriteLine();*/



            string sAction = string.Empty;
            string sDst    = string.Empty;

            //{ "src":"BN83I6IIBX3QP1DS4Y8URO41P2VWOTY9","dst":"aaabbbccc_111222333","msg":"hello"}

            //{ "src":"K91NS8PPF1B7KLNI2VWGO0D49HOM524T","dst":"testid000001_testst000001","msg":"hello"}
            //{"src":"K91NS8PPF1B7KLNI2VWGO0D49HOM524T","dst":"testid000001_testst000001","msg":"start"}
            //{"src":"K91NS8PPF1B7KLNI2VWGO0D49HOM524T","dst":"testid000001_testst000001","msg":"prev"}
            //{"src":"K91NS8PPF1B7KLNI2VWGO0D49HOM524T","dst":"testid000001_testst000001","msg":"next"}

            message_recv = JsonHelper.DeserializeJsonToObject <MQTTMessage_Recv>(e.Payload.ToString());

            sAction = message_recv.msg.ToString().ToLower();
            sDst    = message_recv.dst.ToString();
            strSRC  = message_recv.src.ToString();

            bool isPPTRunning = CheckPPTISRunning(); //确保 sProceName 全局变量被赋值

            if (strDst == sDst)
            {
                if (sAction == "hello")
                {
                    if (!isPPTRunning)
                    {
                        SendState("0");
                    }
                    else
                    {
                        //btnClose.Visible = true;



                        if (ProcessHelper.ProcessIsFront(sProceName))
                        {
                            SendState("3");
                        }
                        else
                        {
                            SendState("1");
                        }
                    }
                }
                else if (sAction == "start")
                {
                    ProcessHelper.BringWindowToFrontNow(sProceName);
                    InputSMLTR.SimulateKeyPress(VirtualKeyCode.F5);
                }
                else if (sAction == "prev")
                {
                    ProcessHelper.BringWindowToFrontNow(sProceName);
                    InputSMLTR.SimulateKeyPress(VirtualKeyCode.UP);
                }
                else if (sAction == "next")
                {
                    ProcessHelper.BringWindowToFrontNow(sProceName);
                    InputSMLTR.SimulateKeyPress(VirtualKeyCode.DOWN);
                }
            }


            return(true);
        }