Ejemplo n.º 1
0
 public static void Disconnect(this Camera camera)
 {
     if (null == camera)
     {
         throw new ArgumentNullException();
     }
     lock (deviceLock)
     {
         camera.HandleDisconnection(DisconnectionReason.Requested);
         Interop.SpotCamService.SpotExit();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new Camera from a Device.
 /// </summary>
 /// <param name="device">The device </param>
 /// <returns>The newly created Camera</returns>
 /// <exception cref="ArgumentNullException">The Device supplied is null</exception>
 /// <exception cref="DeviceNotFound"></exception>
 public static Camera Create(this Device device)
 {
     if (null == device)
     {
         throw new ArgumentNullException();
     }
     if (!device.IsPoweredOn)
     {
         throw new ArgumentException("The device is not powered on");
     }
     lock (deviceLock)
     {
         // The SpotCam service only allows one camera at a time to be controlled.
         if (currentCamera != null)
         {
             currentCamera.HandleDisconnection(DisconnectionReason.ForcedByService);
         }
         currentCamera = null;
         currentCamera = new Camera(device);
         return(currentCamera);
     }
 }