コード例 #1
0
ファイル: Demo.cs プロジェクト: zhangjianqi/PLCNetLib
 private void readMultiAsyncHandler(IAsyncResult ar)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new AsyncCallback(readMultiAsyncHandler), new object[] { ar });
         return;
     }
     try
     {
         object[]     states = (object[])ar.AsyncState;
         PLC          p      = (PLC)states[0];
         int          len    = (int)states[1];
         BinaryReader br     = p.EndReadMulti(ar);
         for (int i = 0; i < len; i++)
         {
             readMultiDGV.Rows[i].Cells[1].Value = br.ReadInt32();
         }
         readMultiStatusL.Text = "Done";
     }
     catch (Exception exc)
     {
         readMultiStatusL.Text = exc.Message;
     }
 }