protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         // dispose managed objects, and dispose objects that implement IDisposable
         if (Device != null)
         {
             // When InitializeOnceAtStartup is not called.
             Device.CameraViewImageSourceBitmapCapture.CameraViewImageSourceBitmapChanged -= Device_CameraViewImageSourceBitmapCapture_CameraViewImageSourceBitmapChanged;
         }
         DetectFaceIntervalMinimumStopwatch.Reset();
         DetectFaceIntervalMinimumStopwatch.Start();
         while (IsDetecting)
         {
             System.Threading.Thread.Sleep(50);
             if (DetectFaceIntervalMinimumStopwatch.ElapsedMilliseconds > 2000)
             {
                 if (ApplicationCommonSettings.IsDebugging)
                 {
                     Debugger.Break();
                 }
                 Console.WriteLine("FaceDetection BackgroundWorkder did not completed.");
                 break;
             }
         }
         if (DlibArray2dUcharImage != null)
         {
             DlibArray2dUcharImage.Dispose(); DlibArray2dUcharImage = null;
         }
         if (DlibHogSvm != null)
         {
             DlibHogSvm.Dispose(); DlibHogSvm = null;
         }
     }
     // release any unmanaged objects and set the object references to null
     disposed = true;
 }
Example #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         // dispose managed objects, and dispose objects that implement IDisposable
         if (DlibHogSvm != null)
         {
             DlibHogSvm.Dispose(); DlibHogSvm = null;
         }
         if (Image != null)
         {
             Image.Dispose(); Image = null;
         }
     }
     // release any unmanaged objects and set the object references to null
     disposed = true;
 }