Exemplo n.º 1
0
 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
     {
     }
 }