Ejemplo n.º 1
0
		public bool GenerateData(LedPanel panel, ref Process process)
		{
			bool result = false;
			try
			{
				for (int i = 0; i < panel.Items.Count; i++)
				{
					for (int j = 0; j < panel.Items[i].Subareas.Count; j++)
					{
						if (panel.Items[i].Subareas[j].Type == LedSubareaType.Subtitle)
						{
							LedDText ledDText = (LedDText)panel.Items[i].Subareas[j].SelectedContent;
							if (ledDText.DoNeedDrawingFull)
							{
								ledDText.DrawMode = LedDrawMode.Full;
								ledDText.Draw();
								ledDText.DrawMode = LedDrawMode.Part;
							}
						}
						else if (panel.Items[i].Subareas[j].Type == LedSubareaType.PictureText)
						{
							LedSubarea ledSubarea = panel.Items[i].Subareas[j];
							for (int k = 0; k < ledSubarea.Contents.Count; k++)
							{
								LedPictureText ledPictureText = (LedPictureText)ledSubarea.Contents[k];
								if (ledPictureText.DoNeedDrawingFull || (ledPictureText.LastDrawn != null && ledPictureText.GetSize() != ledPictureText.LastDrawn.Size))
								{
									ledPictureText.DrawMode = LedDrawMode.Full;
									ledPictureText.Draw();
									ledPictureText.DrawMode = LedDrawMode.Part;
								}
							}
						}
					}
				}
				if (this.isAnimation)
				{
					this.GetAnimationAndBackground(panel);
				}
				process = new Process();
				if (panel.IsLSeries())
				{
					process.PanelBytes = panel.ToLBytes();
					process.ItemTimerLBytes = panel.ToItemTimerLByte();
					process.ItemStartLBytes = panel.ToItemStartLBytes();
					process.ItemLBytes = panel.ToItemLBytes();
				}
				else
				{
					process.PanelBytes = panel.ToBytes();
					process.BmpDataBytes = panel.ToItemBmpDataBytes();
					process.ItemBytes = panel.ToItemBytes();
				}
				result = true;
			}
			catch
			{
				process = null;
				result = false;
			}
			return result;
		}
Ejemplo n.º 2
0
        public void GenerateData()
        {
            if (!this.isThread)
            {
                return;
            }
            base.Invoke(new MethodInvoker(delegate
            {
                this.prgStatus.Value    = 0;
                this.lblSendStatus.Text = formMain.ML.GetStr("Prompt_NowIsGeneratingData");
                this.lblSendStatus.Refresh();
            }));
            Thread.Sleep(100);
            if (formMain.ledsys == null)
            {
                return;
            }
            LedPanel selectedPanel = formMain.ledsys.SelectedPanel;

            if (selectedPanel == null)
            {
                return;
            }
            this.process = new Process();
            if (selectedPanel.IsLSeries())
            {
                this.process.PanelBytes = selectedPanel.ToLBytes();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.prgStatus.Value = 20;
                }));
                Thread.Sleep(100);
                this.process.ItemTimerLBytes = selectedPanel.ToItemTimerLByte();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.prgStatus.Value = 40;
                }));
                Thread.Sleep(100);
                this.process.ItemStartLBytes = selectedPanel.ToItemStartLBytes();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.prgStatus.Value = 60;
                }));
                Thread.Sleep(100);
                this.process.ItemLBytes = selectedPanel.ToItemLBytes();
                if (!this.isThread)
                {
                    return;
                }
                base.Invoke(new MethodInvoker(delegate
                {
                    this.prgStatus.Value = 80;
                }));
                Thread.Sleep(100);
                this.dataBytes = new protocol_data_integration().Program_Packaging_data_L(this.process, selectedPanel.CardAddress, selectedPanel.ProtocolVersion, true);
                if (!this.isThread)
                {
                    return;
                }
            }
            string overlengthMsg        = string.Empty;
            bool   hasContentOverlength = this.HasContentOverlength(selectedPanel, ref overlengthMsg);

            base.Invoke(new MethodInvoker(delegate
            {
                this.prgStatus.Value = 100;
                if (hasContentOverlength)
                {
                    MessageBox.Show(this, overlengthMsg, formMain.ML.GetStr("Display_Prompt"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }));
            Thread.Sleep(100);
        }
Ejemplo n.º 3
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;
            }
        }