private void OnCamAnteriorCommand(object args)
 {
     CamMode = CameraAPI.OperatingMode.ANTERIOR_MODE.ToString();
     camera.setMode(CameraAPI.OperatingMode.ANTERIOR_MODE);
     camera.StopLive();
     camera.Capture();
     flag = false;
 }
 void ConnectCamera()
 {
     try
     {
         camera = CameraAPI.GetInstance();
         camera.Connect();
         camera.NewFrameEvent      += new NewFrameHandler(camera_NewFrameEvent);
         camera.CapturedFrameEvent += new CapturedFrameHandler(camera_capturedFrameEvent);
         camera.setMode(CameraAPI.OperatingMode.POSTERIOR_MODE);
         CamMode = CameraAPI.OperatingMode.POSTERIOR_MODE.ToString();
     }
     catch (Exception ex)
     {
         ModernDialog.ShowMessage("Camera Not Responding. Please restart your process again.", "Alert", MessageBoxButton.OK);
     }
 }