Example #1
0
 private void StartCycleRequest(byte AddressCommand, int RequestType)
 {
     try
     {
         SerialPortSettings.OpenSerialPortConnection(serialPort1);
         ThreadPool.QueueUserWorkItem(new WaitCallback((obj) =>
         {
             while (IsCurrentVoltageRequestCyclical && !Data.IsRequestSingle)
             {
                 if (AddressCommand == AddressCurrentVoltageCommand)
                 {
                     OutputResponceData(AddressCommand, RequestType);
                 }
                 else
                 {
                     OutputResponceData(AddressCommand, RequestType);
                     AddressCommand = AddressCurrentVoltageCommand;
                 }
             }
         }));
     }
     catch (Exception ex)
     {
         Logger.Log.Error(ex.Message);
         MessageBox.Show(ex.Message, "Ошибка!");
     }
 }