Esempio n. 1
0
 /// <summary>
 /// Creates an instance of CameraManagement (if required) and returns it.
 /// </summary>
 /// <param name="scanForCameraDLLs">Passed through to <see cref="InitializeCameras(bool)"/>.</param>
 /// <returns>The singleton object.</returns>
 public static CameraManagement GetInstance(bool scanForCameraDLLs)
 {
     lock (instanceLock)
     {
         if (null == instance)
         {
             instance = new CameraManagement(scanForCameraDLLs);
         }
     }
     return(instance);
 }
Esempio n. 2
0
        public void SelectCamera(Camera cam)
        {
            if (null == cam)
            {
                log.Warn("SelectCamera(null)");
                return;
            }
            log.DebugFormat("SelectCamera({0})", cam.Name);

            Camera myCam = null;
            string dummy;

            try
            {
                myCam = CameraManagement.GetCameraInstanceByName(cam.Name, out dummy);
            }
            catch (ArgumentException)
            {
                string cameraTypeName = cam.GetType().ToString();
                log.DebugFormat("    camera with name {0} not found, trying {1}", cam.Name, cameraTypeName);
                try
                {
                    myCam = CameraManagement.GetCameraInstanceByName(cameraTypeName, out dummy);
                }
                catch (ArgumentException)
                {
                    log.WarnFormat("    camera with names {0} or {1} not found", cam.Name, cameraTypeName);
                    throw;
                }
            }

            this.SelectedCameras.Add(myCam);
            if (SelectedCamerasChanged != null)
            {
                SelectedCamerasChanged(this, new SelectedCamerasChangedArgs(myCam, false));
            }
        }