Пример #1
0
 private void ViaComm_Click(object sender, EventArgs e)
 {
     if (DestNodeName.Text != "")
     {
         byte[] cmd = Pack();
         if (cmd.Length == 0)
         {
             return;
         }
         byte[] Serialcmd = SourceDataClass.CommPackage(171, cmd);
         if (MainForm.pMainForm.mapdoc.WriteMSPCommand(Serialcmd))
         {
             BackText.Clear();
             Commparelabel.Text = "---";
             MainForm.pMainForm.mapdoc.MSPCmdFile.OpenFile(MainForm.pMainForm.SerialCmdPathInfo);
             MainForm.pMainForm.mapdoc.MSPCmdFile.BinaryWrite(Serialcmd);
             MainForm.pMainForm.mapdoc.MSPCmdFile.close();
             MessageBox.Show("命令已发送!");
         }
     }
     else
     {
         MessageBox.Show("请选择一个正确的目的地址!");
     }
 }
Пример #2
0
        public void DrawBacks(SKCanvas canvas, SKRect rect_Card)
        {
            if (BackText == "")
            {
                throw new BasicBlankException("Must have the back text");
            }
            var thisList = BackText.Split(" ").ToList();

            if (thisList.Count > 2)
            {
                throw new Exception("Only 2 lines are supported currently");
            }
            var thisFill  = GetFillColor();
            var thisPaint = GetSolidPaint(thisFill);

            DrawDefaultRectangles(canvas, rect_Card, thisPaint);
            SKPaint textPaint;
            CustomBasicList <SKRect> rectList = new CustomBasicList <SKRect>();

            if (thisList.Count == 1)
            {
                rectList.Add(rect_Card);
            }
            else
            {
                SKRect firstRect;
                firstRect = SKRect.Create(8, 8, rect_Card.Width - 6, rect_Card.Height / 2.1f);
                var secondRect = SKRect.Create(8, rect_Card.Height / 2, rect_Card.Width - 6, rect_Card.Height / 2.1f);
                rectList.Add(firstRect);
                rectList.Add(secondRect);
            }
            if (rectList.Count != thisList.Count)
            {
                throw new BasicBlankException("Numbers Don't Match For Drawing Backs");
            }
            int x = 0;

            foreach (var thisRect in rectList)
            {
                float fontSize;
                var   ThisText = thisList[x];
                if (ThisText.Length == 5)
                {
                    fontSize = rect_Card.Height / 4.2f;
                }
                else
                {
                    fontSize = rect_Card.Height / 3.6f;
                }

                textPaint = MiscHelpers.GetTextPaint(BackFontColor, fontSize);
                canvas.DrawBorderText(ThisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, thisRect);
                x++;
            }
        }
Пример #3
0
 private void ViaNet_Click(object sender, EventArgs e)
 {
     if (DestNodeName.Text != "")
     {
         byte[] cmd = Pack();
         if (cmd.Length == 0)
         {
             return;
         }
         byte[] netcmd = SourceDataClass.NetPackage(cmd);
         MainForm.pMainForm.CommandLineWin.SendCommand("gd -n");
         if (MainForm.pMainForm.CommandLineWin.SendData(netcmd))//正确发送
         {
             BackText.Clear();
             Commparelabel.Text = "---";
             MessageBox.Show("命令已发送!");
         }
     }
     else
     {
         MessageBox.Show("请选择一个正确的目的地址!");
     }
 }
Пример #4
0
 private void ClearBtn_Click(object sender, EventArgs e)
 {
     SourceText.Clear();
     BackText.Clear();
     Commparelabel.Text = "---";
 }