private ICameraDevice GetWiaIDevice(IDeviceInfo devInfo) { // if camera already is connected do nothing if (_deviceEnumerator.GetByWiaId(devInfo.DeviceID) != null) { return(_deviceEnumerator.GetByWiaId(devInfo.DeviceID).CameraDevice); } _deviceEnumerator.RemoveDisconnected(); DeviceDescriptor descriptor = new DeviceDescriptor { WiaDeviceInfo = devInfo, WiaId = devInfo.DeviceID }; ICameraDevice cameraDevice = new WiaCameraDevice(); bool isConnected = cameraDevice.Init(descriptor); descriptor.CameraDevice = cameraDevice; _deviceEnumerator.Add(descriptor); ConnectedDevices.Add(cameraDevice); if (isConnected) { NewCameraConnected(cameraDevice); } //ServiceProvider.DeviceManager.SelectedCameraDevice.ReadDeviceProperties(0); return(SelectedCameraDevice); }
private void AddCanonCameras() { lock (_locker) { foreach (EosCamera eosCamera in GetEosCameras()) { bool shouldbeadded = ConnectedDevices.OfType <CanonSDKBase>().All(camera => camera.PortName != eosCamera.PortName); if (shouldbeadded) { Log.Debug("New canon camera found !"); CanonSDKBase camera = new CanonSDKBase(); Log.Debug("Pas 1"); DeviceDescriptor descriptor = new DeviceDescriptor { EosCamera = eosCamera }; descriptor.CameraDevice = camera; Log.Debug("Pas 2"); camera.Init(eosCamera); Log.Debug("Pas 3"); ConnectedDevices.Add(camera); Log.Debug("Pas 4"); _deviceEnumerator.Add(descriptor); Log.Debug("Pas 5"); NewCameraConnected(camera); Log.Debug("New canon camera found done!"); } } //Thread.Sleep(2500); } }
private void AddCanonCameras() { foreach (EosCamera eosCamera in GetEosCameras()) { bool shouldbeadded = true; foreach (ICameraDevice device in ConnectedDevices) { CanonSDKBase camera = device as CanonSDKBase; if (camera != null) { if (camera.Camera == eosCamera) { shouldbeadded = false; break; } } } if (shouldbeadded) { Log.Debug("New canon camera found !"); CanonSDKBase camera = new CanonSDKBase(); DeviceDescriptor descriptor = new DeviceDescriptor { EosCamera = eosCamera }; descriptor.CameraDevice = camera; NewCameraConnected(camera); camera.Init(eosCamera); ConnectedDevices.Add(camera); _deviceEnumerator.Add(descriptor); } } Thread.Sleep(2500); }