예제 #1
0
 private void btOpenClose_Click(object sender, EventArgs e)
 {
     if (null == _dev)
     {
         MessageBox.Show("打开设备失败!设备对象为空");
         return;
     }
     if (_dev.IsDeviceOpen)
     {
         int err = _dev.CloseDevice();
         if (err != 0)
         {
             MessageBox.Show("关闭设备失败,错误信息:" + _dev.GetErrorInfo(err));
             return;
         }
     }
     else
     {
         int err = _dev.OpenDevice();
         if (err != 0)
         {
             MessageBox.Show("打开设备失败,错误信息:" + _dev.GetErrorInfo(err));
             return;
         }
     }
     AdjustUI();
 }