示例#1
0
 private void ProcessString()
 {
     this.processStringLibrary = new ProcessStringLibrary();
     this.processStringLibrary.BmpDataBytes = this.panel.StringLibrary.ToBmpDataBytes();
     this.processStringLibrary.StartBytes   = this.panel.StringLibrary.ToBytes();
     this.processStringLibrary.PanelBytes   = this.panel.ToLBytes();
     this.isProcessString = false;
 }
示例#2
0
 private void formStringLibrary_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!this.needtoClose)
     {
         e.Cancel = true;
         return;
     }
     if (this.processStringLibrary != null)
     {
         this.processStringLibrary.Dispose();
         this.processStringLibrary = null;
     }
     if (this.USBDirList != null)
     {
         this.USBDirList.Clear();
         this.USBDirList = null;
     }
     this.tmrUSB.Stop();
     this.panel.SetStringLibrary();
     this.fm.RedrawSubarea();
 }
示例#3
0
 private void formSendData_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!this.needtoClose)
     {
         e.Cancel = true;
         return;
     }
     try
     {
         if (this.process != null)
         {
             this.process.Dispose();
             this.process = null;
         }
         if (this.processFirmware != null)
         {
             this.processFirmware.Dispose();
             this.processFirmware = null;
         }
         if (this.processStringLibrary != null)
         {
             this.processStringLibrary.Dispose();
             this.processStringLibrary = null;
         }
         this.isThreadReceiveEvent = false;
         this.isThread             = false;
         this.tmrDaemon.Stop();
         call.OnDeviceCmdReturnResult -= new EventHandler <DeviceCmdEventArgs>(this.OnDeviceCmdReturn);
         if (this.thrReceiveEvent != null && this.thrReceiveEvent.ThreadState == ThreadState.Stopped)
         {
             this.thrReceiveEvent = null;
         }
         GC.Collect();
         GC.WaitForPendingFinalizers();
         GC.Collect();
     }
     catch
     {
     }
 }
示例#4
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;
            }
        }