protected override void Loop(System.Threading.CancellationToken token) { while (token.IsCancellationRequested == false) { if (_navdataAcquisition.IsAlive == false) { _navdataAcquisition.Start(); } Thread.Sleep(10); } //循环结束时 //消除所有启动的线程 if (_navdataAcquisition.IsAlive) { _navdataAcquisition.Stop(); } if (_commandSender.IsAlive) { _commandSender.Stop(); } if (_videoAcquisition.IsAlive) { _videoAcquisition.Stop(); } }
protected override void Loop(CancellationToken token) { while (token.IsCancellationRequested == false) { if (_navdataAcquisition.IsAlive == false) { _navdataAcquisition.Start(); } else if (_navdataAcquisition.IsAcquiring) { if (_commandSender.IsAlive == false) { _commandSender.Start(); } if (_videoAcquisition.IsAlive == false) { _videoAcquisition.Start(); } } Thread.Sleep(10); } _navdataAcquisition.Stop(); _commandSender.Stop(); _videoAcquisition.Stop(); }
private void OnNavdataAcquisitionStopped() { _initializationRequested = false; _videoAcquisition.Stop(); }