Пример #1
0
        private async void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            _updateGuiTimer.Stop();
            if (cam == null)
            {
                return;
            }
            if (flirConnectStatus == true)
            {
                await camLock.WaitAsync();

                RecorderState status = cam.Recorder.Status;
                if (camLock.CurrentCount == 0)
                {
                    camLock.Release();
                }
                if (status == RecorderState.Recording || status == RecorderState.Paused)
                {
                    Command(() => cam.Recorder.Stop(), true);
                    await camLock.WaitAsync();

                    if (camLock.CurrentCount == 0)
                    {
                        camLock.Release();
                    }
                }
                cam.Disconnect();
                cam.ConnectionStatusChanged -= cam_ConnectionStatusChanged;
                cam.GetImage().Changed -= cam_ImageChanged;
                cam.Recorder.RecorderStatusChanged -= cam_RecorderStatusChanged;
                cam.RemoteControl.CommandExecuted  -= cam_CommandExecuted;
            }
            cam.Dispose();
            if (discovery == null)
            {
                return;
            }
            discovery.Dispose();
        }
Пример #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     _updateGuiTimer.Stop();
     if (cam == null)
     {
         return;
     }
     if (flirConnectStatus == true)
     {
         if (cam.Recorder.Status == RecorderState.Recording || cam.Recorder.Status == RecorderState.Stopped)
         {
             cam.Recorder.Stop();
         }
         cam.Disconnect();
         cam.ConnectionStatusChanged -= cam_ConnectionStatusChanged;
         cam.GetImage().Changed -= cam_ImageChanged;
     }
     cam.Dispose();
     if (discovery == null)
     {
         return;
     }
     discovery.Dispose();
 }