コード例 #1
0
 public void Disconnect()
 {
     try
     {
         if (KeepAlive.Enabled)
         {
             KeepAlive.Stop();
         }
         if (Comm.media.IsOpen && m_Status != DeviceState.Disconnecting)
         {
             if (Comm.media is IGXMedia2)
             {
                 if (((IGXMedia2)Comm.media).AsyncWaitHandle != null)
                 {
                     ((IGXMedia2)Comm.media).AsyncWaitHandle.Set();
                 }
             }
             UpdateStatus(DeviceState.Disconnecting);
             communicator.Disconnect();
         }
         else
         {
             Comm.media.Close();
         }
     }
     catch (Exception Ex)
     {
         //Do not show error occurred in disconnect. Write error only to the log file.
         GXLogWriter.WriteLog(Ex.Message);
     }
     finally
     {
         UpdateStatus(DeviceState.Initialized);
     }
 }
コード例 #2
0
 public void Disconnect()
 {
     try
     {
         UpdateStatus(DeviceState.Disconnecting);
         if (KeepAlive.Enabled)
         {
             KeepAlive.Stop();
         }
         communicator.Disconnect();
     }
     catch (Exception Ex)
     {
         //Do not show error occurred in disconnect. Write error only to the log file.
         GXLogWriter.WriteLog(Ex.Message);
     }
     finally
     {
         UpdateStatus(DeviceState.Initialized);
     }
 }