public Core() { InitializeComponent(); this.Icon = Properties.Resources.qr; Notify.Icon = Properties.Resources.qr; br = new BarcodeReader(); Prefs.Load(); string s = Prefs.GetPref("camera", "NIL"); if (s != "NIL") { FilterInfoCollection filters = new FilterInfoCollection(FilterCategory.VideoInputDevice); int i = 0; foreach (FilterInfo device in filters) { if (s == device.Name + "{" + device.MonikerString + "}") { Setting.cam = new VideoCaptureDevice(device.MonikerString); break; } i++; } } Hide(); }
private void Setting_Load(object sender, EventArgs e) { filters = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo device in filters) { CameraDropdown.Items.Add(device.Name + "{" + device.MonikerString + "}"); } if (cam != null) { string target = Prefs.GetPref("camera", "default"); for (int i = 0; i < CameraDropdown.Items.Count; i++) { if ((string)CameraDropdown.Items[i] == target) { CameraDropdown.SelectedIndex = i; break; } } } }