コード例 #1
0
ファイル: Bot.cs プロジェクト: ustechservice/ClashofBots
 public void Stop()
 {
     //Stop the bot
     botWorker.Abort();
     botWorker.Dispose();
     botState = BotState.Free;
 }
コード例 #2
0
        /// <summary>
        /// Destroy this component
        /// </summary>
        public override void Destroy()
        {
            base.Destroy();  // Sets IsDestroying flag

            try
            {
                if (_iSensor != 0)
                {
                    if (_hSensorDataReady != 0)
                    {
                        // Complete worker thread
                        MEDAQLibDLL.SetEvent(_hSensorDataReady);
                        Thread.Sleep(50);
                    }
                    MEDAQLibDLL.CloseSensor(_iSensor);
                    MEDAQLibDLL.ReleaseSensorInstance(_iSensor);
                }
                if (_bw != null)
                {
                    if (_bw.IsBusy)
                    {
                        _bw.CancelAsync();
                    }
                    _bw.Dispose();
                    _bw = null;
                }
            }
            catch (Exception ex)
            {
                U.LogError(ex, "Error disposing '{0}'", Nickname);
            }
            finally
            {
                _bw = null;
            }
        }