コード例 #1
0
 private void SendPackage(ZPackage zPackage)
 {
     ZProtocolProcessObj.WriteFrame(zPackage.Frame);
     for (int i = 0; i < zPackage.Blocks.Length; i++)
     {
         ZProtocolProcessObj.AddBlock(zPackage.Blocks[i]);
     }
     ZProtocolProcessObj.Send();
 }
コード例 #2
0
 private void btSend_Click(object sender, EventArgs e)
 {
     try
     {
         ZPackage zPackage = MakeZPackage();
         SendPackage(zPackage);
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
コード例 #3
0
        private ZPackage MakeZPackage()
        {
            ZPackage zPackage = new ZPackage();

            zPackage.Frame.PackageNum = (byte)ZBlockDescribes.Count;
            zPackage.Frame.Reserve    = byte.Parse(tbReserve.Text);
            zPackage.Frame.Source     = byte.Parse(tbSource.Text);
            zPackage.Frame.Target     = byte.Parse(tbTarget.Text);
            zPackage.Frame.S1         = ZProtocolProcess.S1;
            zPackage.Frame.S2         = ZProtocolProcess.S2;

            zPackage.Blocks = new ZBlock[zPackage.Frame.PackageNum];
            for (int i = 0; i < zPackage.Frame.PackageNum; i++)
            {
                zPackage.Blocks[i] = Converter.GetZBlock((DataBlock)flowLayoutPanel2.Controls[i], ZBlockDescribes[i]);
            }

            return(zPackage);
        }
コード例 #4
0
 //保存
 private void btSave_Click(object sender, EventArgs e)
 {
     if (tbName.Text != "")
     {
         if (Packages.ContainsKey(tbName.Text) == false)
         {
             ZPackage zPackage = MakeZPackage();
             Packages.Add(tbName.Text, zPackage);
             UpdatePackagelist();
         }
         else
         {
             MessageBox.Show("名称重复");
         }
     }
     else
     {
         MessageBox.Show("名称不能为空");
     }
 }
コード例 #5
0
 private void SendPackage(ZPackage zPackage)
 {
     ZProtocolProcessObj.WriteFrame(zPackage.Frame);
     for (int i = 0; i < zPackage.Blocks.Length; i++)
     {
         ZProtocolProcessObj.AddBlock(zPackage.Blocks[i]);
     }
     ZProtocolProcessObj.Send();
 }
コード例 #6
0
        private ZPackage MakeZPackage()
        {
            ZPackage zPackage = new ZPackage();

            zPackage.Frame.PackageNum = (byte)ZBlockDescribes.Count;
            zPackage.Frame.Reserve = byte.Parse(tbReserve.Text);
            zPackage.Frame.Source = byte.Parse(tbSource.Text);
            zPackage.Frame.Target = byte.Parse(tbTarget.Text);
            zPackage.Frame.S1 = ZProtocolProcess.S1;
            zPackage.Frame.S2 = ZProtocolProcess.S2;

            zPackage.Blocks = new ZBlock[zPackage.Frame.PackageNum];
            for (int i = 0; i < zPackage.Frame.PackageNum; i++)
            {
                zPackage.Blocks[i] = Converter.GetZBlock((DataBlock)flowLayoutPanel2.Controls[i], ZBlockDescribes[i]);
            }

            return zPackage;
        }