Exemple #1
0
        private void CheckCardType()
        {
            this.isCmdOver = false;
            int  i    = 0;
            bool flag = false;

            base.Invoke(new MethodInvoker(delegate
            {
                this.lblSendStatus.Text = formMain.ML.GetStr("formSendData_message_Checking_model");
                this.lblSendStatus.Refresh();
            }));
            if (!this.isWiFiProductionTest)
            {
                Thread.Sleep(100);
            }
            while (i < 5)
            {
                i++;
                SEND_CMD_RET_VALUE sEND_CMD_RET_VALUE = SEND_CMD_RET_VALUE.ER_NONE_INIT;
                if (formMain.IServer != null)
                {
                    sEND_CMD_RET_VALUE = formMain.IServer.send_cmd_to_device_async(17, null, formMain.ledsys.SelectedPanel.ProductID);
                }
                if (sEND_CMD_RET_VALUE == SEND_CMD_RET_VALUE.POST_TO_RS_SERVER_OK)
                {
                    flag = true;
                    break;
                }
                if (sEND_CMD_RET_VALUE != SEND_CMD_RET_VALUE.IPC_communication_FAILED)
                {
                    break;
                }
                this.RestartIPCServer();
            }
            if (!flag)
            {
                base.Invoke(new MethodInvoker(delegate
                {
                    this.tmrDaemon.Stop();
                    MessageBox.Show(this, formMain.ML.GetStr("Display_CommunicationFailed"));
                    this.needtoClose = true;
                    base.Close();
                }));
            }
        }
Exemple #2
0
        private void SendData()
        {
            this.dtStart   = DateTime.Now;
            this.isCmdOver = false;
            int  i                = 0;
            bool flag             = false;
            bool flag2            = false;
            bool isMemoryOverSize = false;

            while (i < 5)
            {
                if (!this.isThread)
                {
                    return;
                }
                i++;
                flag2 = false;
                base.Invoke(new MethodInvoker(delegate
                {
                    this.pgbStatus.Value    = 0;
                    this.lblSendStatus.Text = formMain.ML.GetStr("Prompt_NowIsSendingData");
                    this.lblSendStatus.Refresh();
                }));
                if (!this.isWiFiProductionTest)
                {
                    Thread.Sleep(100);
                }
                SEND_CMD_RET_VALUE sEND_CMD_RET_VALUE = SEND_CMD_RET_VALUE.ER_NONE_INIT;
                if (this.isUpdataCode)
                {
                    if (this.processFirmware != null)
                    {
                        flag2 = true;
                    }
                    if (formMain.IServer != null && flag2)
                    {
                        sEND_CMD_RET_VALUE = formMain.IServer.send_cmd_to_device_async(113, this.processFirmware, formMain.ledsys.SelectedPanel.ProductID);
                    }
                }
                else if (this.isDownloadStringLibrary)
                {
                    if (this.processStringLibrary != null)
                    {
                        flag2 = true;
                    }
                    if (formMain.IServer != null && flag2)
                    {
                        sEND_CMD_RET_VALUE = formMain.IServer.send_cmd_to_device_async(8, this.processStringLibrary, formMain.ledsys.SelectedPanel.ProductID);
                    }
                }
                else
                {
                    if (this.process != null)
                    {
                        if (this.process.GetBytesLength() <= formMain.ledsys.SelectedPanel.GetFlashCapacity())
                        {
                            flag2 = true;
                        }
                        else
                        {
                            isMemoryOverSize = true;
                        }
                    }
                    if (formMain.IServer != null && flag2)
                    {
                        sEND_CMD_RET_VALUE = formMain.IServer.send_cmd_to_device_async(1, this.process, formMain.ledsys.SelectedPanel.ProductID);
                    }
                }
                if (sEND_CMD_RET_VALUE == SEND_CMD_RET_VALUE.POST_TO_RS_SERVER_OK)
                {
                    flag = true;
                    break;
                }
                if (sEND_CMD_RET_VALUE == SEND_CMD_RET_VALUE.IPC_communication_FAILED)
                {
                    this.RestartIPCServer();
                }
                else
                {
                    if (sEND_CMD_RET_VALUE != SEND_CMD_RET_VALUE.ER_NONE_INIT)
                    {
                        flag2 = true;
                        break;
                    }
                    break;
                }
            }
            if (!flag2)
            {
                base.Invoke(new MethodInvoker(delegate
                {
                    this.tmrDaemon.Stop();
                    if (isMemoryOverSize)
                    {
                        MessageBox.Show(this, formMain.ML.GetStr("Prompt_MemoryOverSize"));
                    }
                    else
                    {
                        MessageBox.Show(this, formMain.ML.GetStr("Display_CommunicationFailed"));
                    }
                    this.needtoClose = true;
                    this.Close();
                }));
                return;
            }
            if (!flag)
            {
                base.Invoke(new MethodInvoker(delegate
                {
                    this.tmrDaemon.Stop();
                    MessageBox.Show(this, formMain.ML.GetStr("Display_CommunicationFailed"));
                    this.needtoClose = true;
                    base.Close();
                }));
            }
        }
Exemple #3
0
        private void SingleSend(object obj)
        {
            int num = (int)obj;

            if (num < 0)
            {
                this.thrCount--;
                return;
            }
            Screen_Display_Class sdc          = formGroupSendingSingle.screenSendGroup[num];
            LedPanel             panel_NO     = sdc.Panel_NO;
            DataGridViewCell     dgvcState    = this.dgvSendState.Rows[num].Cells[4];
            DataGridViewCell     dgvcProgress = this.dgvSendState.Rows[num].Cells[5];
            bool flag = false;

            for (int i = 0; i < LedCommunicationConst.ProtocolSendVersionList.Length; i++)
            {
                if (panel_NO.ProtocolVersion == LedCommunicationConst.ProtocolSendVersionList[i])
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                sdc.Send_State    = 3;
                sdc.SendCompleted = true;
                sdc.State_Message = formMain.ML.GetStr("formGroupSending_CommunicationMessage_protocolVersionNumberInconsistent");
                this.StateColor   = 2;
                base.Invoke(new MethodInvoker(delegate
                {
                    dgvcState.Value           = sdc.State_Message;
                    dgvcState.Style.ForeColor = this.StateOfColor(this.StateColor);
                }));
                Thread.Sleep(500);
                this.thrCount--;
                return;
            }
            if (sdc.ResendCount == 0)
            {
                sdc.State_Message = formMain.ML.GetStr("formGroupSending_CommunicationMessage_StartSending");
                this.StateColor   = 0;
                base.Invoke(new MethodInvoker(delegate
                {
                    dgvcProgress.Value        = 0;
                    dgvcState.Value           = sdc.State_Message;
                    dgvcState.Style.ForeColor = this.StateOfColor(this.StateColor);
                    dgvcState.ToolTipText     = string.Empty;
                    this.dgvSendState.Refresh();
                }));
                Thread.Sleep(800);
            }
            int  j     = 0;
            bool flag2 = false;

            while (j < 5)
            {
                j++;
                SEND_CMD_RET_VALUE sEND_CMD_RET_VALUE = SEND_CMD_RET_VALUE.ER_NONE_INIT;
                if (formMain.IServer != null)
                {
                    sEND_CMD_RET_VALUE = formMain.IServer.send_cmd_to_device_async((byte)this.command, this.commData, panel_NO.ProductID);
                }
                if (sEND_CMD_RET_VALUE == SEND_CMD_RET_VALUE.POST_TO_RS_SERVER_OK)
                {
                    flag2 = true;
                    break;
                }
                if (sEND_CMD_RET_VALUE != SEND_CMD_RET_VALUE.IPC_communication_FAILED || sEND_CMD_RET_VALUE != SEND_CMD_RET_VALUE.IPC_communication_FAILED)
                {
                    break;
                }
                if (!this.isRestarting)
                {
                    this.RestartIPCServer();
                }
                DateTime now      = DateTime.Now;
                DateTime now2     = DateTime.Now;
                TimeSpan timeSpan = now2 - now;
                while (this.isRestarting)
                {
                    if (timeSpan.TotalSeconds >= 120.0)
                    {
                        break;
                    }
                    Thread.Sleep(200);
                    now2     = DateTime.Now;
                    timeSpan = now2 - now;
                }
            }
            if (!flag2)
            {
                this.failureCount++;
                sdc.Send_State    = 3;
                sdc.SendCompleted = true;
                sdc.State_Message = formMain.ML.GetStr("Display_CommunicationFailed");
                this.StateColor   = 2;
                base.Invoke(new MethodInvoker(delegate
                {
                    dgvcState.Value           = sdc.State_Message;
                    dgvcState.Style.ForeColor = this.StateOfColor(this.StateColor);
                }));
                Thread.Sleep(500);
            }
            else
            {
                sdc.State_Message = formMain.ML.GetStr("Prompt_NowIsSendingData");
                this.StateColor   = 0;
                base.Invoke(new MethodInvoker(delegate
                {
                    dgvcState.Value           = sdc.State_Message;
                    dgvcState.Style.ForeColor = this.StateOfColor(this.StateColor);
                }));
                Thread.Sleep(500);
            }
            this.thrCount--;
        }
Exemple #4
0
        private void StartSend()
        {
            bool flag = false;
            int  num  = 0;

            while (num < LedCommunicationConst.ProtocolSendVersionList.Length && this.isThread)
            {
                if (this.panel.ProtocolVersion == LedCommunicationConst.ProtocolSendVersionList[num])
                {
                    flag = true;
                    break;
                }
                num++;
            }
            if (!flag && this.isThread)
            {
                base.Invoke(new MethodInvoker(delegate
                {
                    this.tmrDaemon.Stop();
                    MessageBox.Show(this, formMain.ML.GetStr("Form_find_device_message_VersionNumber_Inconsistent"));
                    this.needtoClose = true;
                    base.Close();
                }));
                return;
            }
            this.isCmdOver = false;
            int  num2  = 0;
            bool flag2 = false;

            while (num2 < 5 && this.isThread)
            {
                num2++;
                formSendSingle.LastSendResult = false;
                this.isReceiveEvent           = false;
                this.dtStart = DateTime.Now;
                SEND_CMD_RET_VALUE sEND_CMD_RET_VALUE = SEND_CMD_RET_VALUE.ER_NONE_INIT;
                if (formMain.IServer != null)
                {
                    sEND_CMD_RET_VALUE = formMain.IServer.send_cmd_to_device_async((byte)this.command, this.commData, this.panel.ProductID);
                }
                if (sEND_CMD_RET_VALUE == SEND_CMD_RET_VALUE.POST_TO_RS_SERVER_OK)
                {
                    flag2 = true;
                    break;
                }
                if (sEND_CMD_RET_VALUE != SEND_CMD_RET_VALUE.IPC_communication_FAILED)
                {
                    break;
                }
                this.RestartIPCServer();
            }
            if (!flag2 && this.isThread)
            {
                base.Invoke(new MethodInvoker(delegate
                {
                    this.tmrDaemon.Stop();
                    MessageBox.Show(this, formMain.ML.GetStr("Display_CommunicationFailed"));
                    this.needtoClose = true;
                    base.Close();
                }));
            }
        }