Example #1
0
        public void GenerateData()
        {
            if (!this.isThread)
            {
                return;
            }
            base.Invoke(new MethodInvoker(delegate
            {
                this.pgbStatus.Value    = 0;
                this.lblSendStatus.Text = formMain.ML.GetStr("Prompt_NowIsGeneratingData");
                this.lblSendStatus.Refresh();
            }));
            if (!this.isWiFiProductionTest)
            {
                Thread.Sleep(100);
            }
            if (formMain.ledsys == null)
            {
                return;
            }
            LedPanel selectedPanel = formMain.ledsys.SelectedPanel;

            if (selectedPanel == null)
            {
                return;
            }
            if (this.isUpdataCode)
            {
                this.processFirmware = new ProcessFirmware();
                this.processFirmware.FirmwareBytes = selectedPanel.ToFirmwareBytes(false);
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.pgbStatus.Value = 100;
                    if (this.processFirmware != null)
                    {
                        this.totalFrame         = this.processFirmware.GetBytesFrame();
                        this.lblTotalFrame.Text = this.totalFrame.ToString();
                        this.lblTotalFrame.Refresh();
                    }
                }));
                Thread.Sleep(100);
                return;
            }
            else
            {
                if (!this.isDownloadStringLibrary)
                {
                    this.process = new Process();
                    if (selectedPanel.IsLSeries())
                    {
                        this.process.PanelBytes = selectedPanel.ToLBytes();
                        if (!this.isThread)
                        {
                            return;
                        }
                        base.Invoke(new MethodInvoker(delegate
                        {
                            this.pgbStatus.Value = 30;
                        }));
                        if (!this.isWiFiProductionTest)
                        {
                            Thread.Sleep(100);
                        }
                        this.process.ItemTimerLBytes = selectedPanel.ToItemTimerLByte();
                        if (!this.isThread)
                        {
                            return;
                        }
                        base.Invoke(new MethodInvoker(delegate
                        {
                            this.pgbStatus.Value = 50;
                        }));
                        if (!this.isWiFiProductionTest)
                        {
                            Thread.Sleep(100);
                        }
                        this.process.ItemStartLBytes = selectedPanel.ToItemStartLBytes();
                        if (!this.isThread)
                        {
                            return;
                        }
                        base.Invoke(new MethodInvoker(delegate
                        {
                            this.pgbStatus.Value = 70;
                        }));
                        if (!this.isWiFiProductionTest)
                        {
                            Thread.Sleep(100);
                        }
                        this.process.ItemLBytes = selectedPanel.ToItemLBytes();
                        if (!this.isThread)
                        {
                            return;
                        }
                    }
                    else
                    {
                        this.process.PanelBytes = selectedPanel.ToBytes();
                        if (!this.isThread)
                        {
                            return;
                        }
                        base.Invoke(new MethodInvoker(delegate
                        {
                            this.pgbStatus.Value = 30;
                        }));
                        if (!this.isWiFiProductionTest)
                        {
                            Thread.Sleep(100);
                        }
                        this.process.BmpDataBytes = selectedPanel.ToItemBmpDataBytes();
                        if (!this.isThread)
                        {
                            return;
                        }
                        base.Invoke(new MethodInvoker(delegate
                        {
                            this.pgbStatus.Value = 70;
                        }));
                        if (!this.isWiFiProductionTest)
                        {
                            Thread.Sleep(100);
                        }
                        this.process.ItemBytes = selectedPanel.ToItemBytes();
                        if (!this.isThread)
                        {
                            return;
                        }
                    }
                    string overlengthMsg        = string.Empty;
                    bool   hasContentOverlength = this.HasContentOverlength(selectedPanel, ref overlengthMsg);
                    base.Invoke(new MethodInvoker(delegate
                    {
                        this.pgbStatus.Value = 100;
                        if (this.process != null)
                        {
                            this.totalFrame         = this.process.GetBytesFrame();
                            this.lblTotalFrame.Text = this.totalFrame.ToString();
                            this.lblTotalFrame.Refresh();
                        }
                        if (hasContentOverlength)
                        {
                            MessageBox.Show(this, overlengthMsg, formMain.ML.GetStr("Display_Prompt"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }));
                    if (!this.isWiFiProductionTest)
                    {
                        Thread.Sleep(100);
                    }
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.pgbStatus.Style = ProgressBarStyle.Marquee;
                }));
                Thread.Sleep(100);
                this.processStringLibrary = new ProcessStringLibrary();
                this.processStringLibrary.BmpDataBytes = selectedPanel.StringLibrary.ToBmpDataBytes();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.pgbStatus.Style = ProgressBarStyle.Blocks;
                    this.pgbStatus.Value = 80;
                }));
                Thread.Sleep(100);
                this.processStringLibrary.StartBytes = selectedPanel.StringLibrary.ToBytes();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.pgbStatus.Style = ProgressBarStyle.Blocks;
                    this.pgbStatus.Value = 90;
                }));
                Thread.Sleep(100);
                this.processStringLibrary.PanelBytes = selectedPanel.ToLBytes();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.pgbStatus.Value = 100;
                    if (this.processStringLibrary != null)
                    {
                        this.totalFrame         = this.processStringLibrary.GetBytesFrame();
                        this.lblTotalFrame.Text = this.totalFrame.ToString();
                        this.lblTotalFrame.Refresh();
                    }
                }));
                Thread.Sleep(100);
                return;
            }
        }