public CameraDeviceManager(string datafolder=null) { UseExperimentalDrivers = true; StartInNewThread = false; SelectedCameraDevice = new NotConnectedCameraDevice(); ConnectedDevices = new AsyncObservableCollection<ICameraDevice>(); _deviceEnumerator = new DeviceDescriptorEnumerator(); LiveViewImage = new Dictionary<ICameraDevice, byte[]>(); LastCapturedImage = new Dictionary<ICameraDevice, string>(); WifiDeviceProviders = new List<IWifiDeviceProvider>(); // prevent program crash in something wrong with wia try { WiaDeviceManager = new DeviceManager(); WiaDeviceManager.RegisterEvent(Conts.wiaEventDeviceConnected, "*"); WiaDeviceManager.RegisterEvent(Conts.wiaEventDeviceDisconnected, "*"); WiaDeviceManager.OnEvent += DeviceManager_OnEvent; } catch (Exception exception) { Log.Error("Error initialize WIA", exception); } if (datafolder != null && Directory.Exists(datafolder)) { try { var files = Directory.GetFiles(datafolder, "*.xml"); foreach (var file in files) { var device = DeviceDescription.Load(file); if (device != null) _deviceDescriptions.Add(device); } } catch (Exception) { Log.Error("Error loading custom data"); } } }
public CameraDeviceManager() { UseExperimentalDrivers = true; SelectedCameraDevice = new NotConnectedCameraDevice(); ConnectedDevices = new AsyncObservableCollection<ICameraDevice>(); _deviceEnumerator = new DeviceDescriptorEnumerator(); LiveViewImage = new Dictionary<ICameraDevice, byte[]>(); // prevent program crash in something wrong with wia try { WiaDeviceManager = new DeviceManager(); WiaDeviceManager.RegisterEvent(Conts.wiaEventDeviceConnected, "*"); WiaDeviceManager.RegisterEvent(Conts.wiaEventDeviceDisconnected, "*"); WiaDeviceManager.OnEvent += DeviceManager_OnEvent; } catch (Exception exception) { Log.Error("Error initialize WIA", exception); } }