private void btnOK_Click(object sender, EventArgs e) { try { int num = 0; foreach (TreeNode treeNode in this.tvwPanel.Nodes) { if (treeNode.Nodes != null) { foreach (TreeNode treeNode2 in treeNode.Nodes) { if (treeNode2 != null && treeNode2.Checked && (treeNode2.Tag.GetType() == typeof(LedPanel) || treeNode2.Tag.GetType() == typeof(LedPanelCloud))) { num++; } } } } if (num == 0) { MessageBox.Show(this, formMain.ML.GetStr("formPanelSelectForItem_Message_PleaseSelectPanel")); } else { if (this.mode == ExecuteMode.ShareItem) { this.originalItem.SharedItemOfPanelIDs.Clear(); } foreach (TreeNode treeNode3 in this.tvwPanel.Nodes) { if (treeNode3.Nodes != null) { foreach (TreeNode treeNode4 in treeNode3.Nodes) { if (treeNode4 != null && treeNode4.Checked && (treeNode4.Tag.GetType() == typeof(LedPanel) || treeNode4.Tag.GetType() == typeof(LedPanelCloud))) { LedPanel ledPanel = (LedPanel)treeNode4.Tag; if (this.mode == ExecuteMode.CopyItem) { LedItem ledItem = new LedItem(); if (ledPanel.Items == null) { ledPanel.Items = new List <LedItem>(); } int num2 = ledPanel.Items.Count; if (num2 > 0) { foreach (LedItem current in ledPanel.Items) { if (num2 < current.No) { num2 = current.No; } } } num2++; ledItem.TextName = formMain.ML.GetStr("Display_Item") + num2; ledItem.ValueName = ledItem.TextName; ledItem.No = num2; ledItem.ParentPanel = ledPanel; if (this.originalItem != null) { ledItem.Copy(this.originalItem); } ledPanel.AddItem(ledItem); } else if (this.mode == ExecuteMode.CopyPanelItems) { ledPanel.CopyItems(this.originalPanel, formMain.ML.GetStr("Display_Item")); } else if (this.mode == ExecuteMode.ShareItem) { LedSharedItem ledSharedItem = new LedSharedItem(); if (ledPanel.Items == null) { ledPanel.Items = new List <LedItem>(); } ledSharedItem.Share(this.originalItem); ledSharedItem.TextName = this.itemName; ledPanel.AddSharedItem(ledSharedItem); this.originalItem.SharedItemOfPanelIDs.Add(ledPanel.ID); } } } } } if (this.mode == ExecuteMode.ShareItem) { this.originalItem.TextName = this.itemName; this.originalItem.Shared = true; formMain.ledsys.SharedItemNoCounter = 1; } base.DialogResult = DialogResult.OK; base.Close(); } } catch (Exception ex) { MessageBox.Show(this, formMain.ML.GetStr("formPanelSelectForItem_Message_ExceptionError") + ex.Message); } }
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 { } }