private void saveSinglePanelWifiData(string pSavePath) { LedPanel selectedPanel = formMain.ledsys.SelectedPanel; if (selectedPanel == null) { MessageBox.Show(formMain.ML.GetStr("NETCARD_message_Save_Failed")); return; } ProcessWiFi processWiFi = new ProcessWiFi(); processWiFi.PanelBytes = selectedPanel.ToBytes(); processWiFi.TimerSwitchBytes = selectedPanel.TimerSwitch.ToBytes(); processWiFi.LuminanceBytes = selectedPanel.Luminance.ToBytes(); processWiFi.BmpDataBytes = selectedPanel.ToItemBmpDataBytes(); processWiFi.ItemBytes = selectedPanel.ToItemBytes(); protocol_data_integration protocol_data_integration = new protocol_data_integration(); byte[] array = protocol_data_integration.WritingData_WIFI_Pack(processWiFi); if (array != null) { FileStream fileStream = new FileStream(pSavePath, FileMode.Create); fileStream.Write(array, 0, array.Length); fileStream.Close(); MessageBox.Show(formMain.ML.GetStr("NETCARD_message_Save_Successed")); base.Close(); return; } MessageBox.Show(formMain.ML.GetStr("NETCARD_message_Save_Failed")); }
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; } }
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; }
private void SendSingle(object pObj) { try { GprsContentInfo gprsContentInfo = (GprsContentInfo)pObj; gprsContentInfo.FontSize = formGprsSendAll.getFontSizeByHeight(gprsContentInfo.Height, 0.1f); gprsContentInfo.Content = formGprsSendAll.textList.EDText.Text; gprsContentInfo.ContentFont = formGprsSendAll.textList.EDText.Font.GetFont((float)gprsContentInfo.FontSize); byte[] bytes = GprsAdministrator.API_DownLoadRoutingData(gprsContentInfo.Id); LedPanel ledPanel = LedPanel.Parse(bytes); gprsContentInfo.LedModel = ledPanel.CardType.ToString().Replace("_", "-"); gprsContentInfo.Width = ledPanel.Width; gprsContentInfo.Height = ledPanel.Height; gprsContentInfo.Panel = ledPanel; LedItem ledItem = new LedItem(); ledItem.Edge = formMain.NewEdgeData(); LedDText ledDText = new LedDText(); ledDText.EffectsSetting.EntryMode = 3; ledDText.EffectsSetting.EntrySpeed = formGprsSendAll.textList.EffectsSetting.EntrySpeed; ledDText.Edge = formMain.NewEdgeData(); ledDText.EDText.Text = gprsContentInfo.Content; ledDText.EDText.ForeColor = LedColorConst.Red; ledDText.EDText.Font = new LedFont(gprsContentInfo.ContentFont); ledDText.EDText.Kerning = formGprsSendAll.textList.EDText.Kerning; ledDText.DrawMode = LedDrawMode.Full; System.Drawing.Size size = new System.Drawing.Size(gprsContentInfo.Width, gprsContentInfo.Height); ledItem.AddSubarea(new LedSubarea(0, 0, size.Width, size.Height, ledDText) { Type = LedSubareaType.PictureText }); ledPanel.AddItem(ledItem); ledDText.PreviewDraw(); gprsContentInfo.BitmapList = ledDText.BmpList; Process process = new Process(); process.PanelBytes = ledPanel.ToBytes(); process.BmpDataBytes = ledPanel.ToItemBmpDataBytes(); process.ItemBytes = ledPanel.ToItemBytes(); IList <byte> list = new List <byte>(); IList <byte[]> list2 = protocol_GPRS.Send_Pack_GPRS(formMain.ledsys.SelectedPanel.CardAddress, 0, LedCmdType.Send_Begin, process, formMain.ledsys.SelectedPanel.ProtocolVersion); if (list2 != null && list2.Count > 0) { for (int i = 0; i < list2.Count; i++) { for (int j = 0; j < list2[i].Length; j++) { list.Add(list2[i][j]); } } } byte[] array = new byte[list.Count]; list.CopyTo(array, 0); string text = Application.StartupPath + "\\" + gprsContentInfo.TerminalCode + "GPRS.zhd"; FileStream fileStream = new FileStream(text, FileMode.Create, FileAccess.Write); fileStream.Write(array, 0, array.Length); fileStream.Close(); GprsAdministrator.API_UPLoadFile2(gprsContentInfo.Id, text, 1052); this.gprsSenderForm.UpdateSendPanel(gprsContentInfo.Id); gprsContentInfo.Status = "已上传"; this.removepanel(gprsContentInfo); } catch { } }