Пример #1
0
 /// <summary>
 /// Stops the execution of <see cref="ServiceProcess"/> if it executing.
 /// </summary>
 public void Abort()
 {
     // We'll abort the process only if it is currently executing.
     if (m_processThread != null)
     {
         if (m_processThread.IsAlive)
         {
             m_processThread.Abort();
         }
     }
     m_processThread = null;
 }
Пример #2
0
        /// <summary>
        /// Disconnects the <see cref="FileClient"/> from the <see cref="FileStream"/>.
        /// </summary>
        public override void Disconnect()
        {
            if (CurrentState != ClientState.Disconnected)
            {
                m_fileClient.Reset();
                m_receiveDataTimer.Stop();

                if (m_connectionThread != null)
                {
                    m_connectionThread.Abort();
                }

                OnConnectionTerminated();
            }
        }
Пример #3
0
        /// <summary>
        /// Disconnects the <see cref="SerialClient"/> from the <see cref="SerialPort"/>.
        /// </summary>
        public override void Disconnect()
        {
            if (CurrentState != ClientState.Disconnected)
            {
                if (m_serialClient.Provider != null)
                {
                    m_serialClient.Provider.DataReceived  -= SerialPort_DataReceived;
                    m_serialClient.Provider.ErrorReceived -= SerialPort_ErrorReceived;
                }

                m_serialClient.Reset();

                if (m_connectionThread != null)
                {
                    m_connectionThread.Abort();
                }

                OnConnectionTerminated();
            }
        }