/// <summary>
        /// 重写关闭代码
        /// 将开启的资源关闭
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected override void OnClosed(EventArgs e)
        {
            if (_autopilot != null)
            {
                _autopilot.UnbindFromClient();
                _autopilot.Stop();
            }

            StopRecording();

            _droneClient.Dispose();
            if (_videoPacketDecoderWorker != null)
            {
                _videoPacketDecoderWorker.Dispose();
            }

            _viconPositionGet.Dispose();

            if (_pwrite != null)
            {
                _pwrite.Stop();
                _pwrite.Join();
                _pwrite.Dispose();
            }
            if (_viconPositionGet != null)
            {
                _viconPositionGet.Dispose();
            }


            base.OnClosed(e);
        }
Beispiel #2
0
        protected override void OnClosed(EventArgs e)
        {
            RemoveHandler(Keyboard.KeyDownEvent, new KeyEventHandler(Window_KeyDown_1));
            RemoveHandler(Keyboard.KeyUpEvent, new KeyEventHandler(Window_KeyUp_1));
            //停止与飞机的连接
            foreach (TestViewItem t in _drones)
            {
                t.drone.Stop();
                t.drone.Join();
            }
            //停止定时器
            DelayTimer.IsEnabled = false;
            _p2pTimer.IsEnabled  = false;

            //资源释放
            _logWriteStream.Write(tb_log.Text);
            _logWriteStream.Flush();

            _viconPositionGet.Dispose();

            _logWriteStream.Dispose();
            _logFileStream.Dispose();

            base.OnClosed(e);
        }