Пример #1
0
 public static void BulkReadRenderResult(HslCommunication.Core.IReadWriteNet readWrite, TextBox addTextBox, TextBox lengthTextBox, TextBox resultTextBox)
 {
     try
     {
         OperateResult <byte[]> read = readWrite.Read(addTextBox.Text, ushort.Parse(lengthTextBox.Text));
         if (read.IsSuccess)
         {
             resultTextBox.Text = "Result:" + HslCommunication.BasicFramework.SoftBasic.ByteToHexString(read.Content);
         }
         else
         {
             MessageBox.Show("Read Failed:" + read.ToMessageShowString( ));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Read Failed:" + ex.Message);
     }
 }
Пример #2
0
 public void SetReadWrite(IReadWriteNet readWrite)
 {
     ReadWriteNet = readWrite;
     // 启动后台线程,定时读取PLC中的数据,然后在曲线控件中显示
     if (!isThreadRun)
     {
         if (!int.TryParse("10", out timeSleep))
         {
             MessageBox.Show("Time input wrong!");
             return;
         }
         isThreadRun         = true;
         thread              = new Thread(ThreadReadServer);
         thread.IsBackground = true;
         thread.Start();
     }
     else
     {
         isThreadRun = false;
     }
 }
Пример #3
0
 public bool ReadBool(string Address)
 {
     HslCommunication.Core.IReadWriteNet RW = HslDevice;
     return(Hsl(HslDevice.ReadBool(Address)));
 }