private void ComboBoxCamera_Loaded(object sender, RoutedEventArgs e) { var devs = VideoDevice.Devices().ToList(); ComboBoxCamera.ItemsSource = devs; ComboBoxCamera.DisplayMemberPath = nameof(VideoDevice.Name); var devIndex = devs.FindIndex(dev => dev.SymbolicLink == Config.Raw.DeviceId); if (devIndex >= 0) { var res = devs[devIndex].Resolutions.ToList(); ComboBoxResolution.ItemsSource = res; var resIndex = res.FindIndex(r => r.Width == Config.Raw.Width && r.Height == Config.Raw.Height); ComboBoxResolution.SelectedIndex = resIndex >= 0 ? resIndex : 0; } ComboBoxCamera.SelectedIndex = devIndex >= 0 ? devIndex : 0; }
private void ComboBoxWebcam_Loaded(object sender, RoutedEventArgs e) { ComboBoxWebcam.ItemsSource = VideoDevice.Devices(); ComboBoxWebcam.DisplayMemberPath = "Name"; ComboBoxWebcam.SelectedIndex = 0; }