public override void OnPause()
        {
            base.OnPause();

            _camera?.Release();
            _camera = null;

            _orientationListner.Disable();

            _holder.RemoveCallback(this);
            _holder.Dispose();
            _holder = null;
        }
 protected override void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             if (holder != null)
             {
                 holder.Dispose();
             }
             if (cancellationTokenSource != null)
             {
                 cancellationTokenSource.Dispose();
             }
         }
         disposed = true;
         base.Dispose(disposing);
     }
 }
Exemplo n.º 3
0
        public bool Stop()
        {
            bool result = true;

            try {
                if (!IsStopped)
                {
                    surfaceHolder.Dispose();
                    windowManager.RemoveView(surfaceView);
                    surfaceView.Dispose();
                    windowManager.Dispose();
                    IsStopped = true;
                    cameraPreviewCallback.GotchaAFrameCallback = null;
                }
            } catch (Exception e) {
                Log.Error(TAG, "Error: " + e.StackTrace);
                result = false;
            }
            return(result);
        }