using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using TeamAAS.Camera; using TeamAAS.Core; namespace Plugins.Standard.Core { public class CameraDeviceConverter : StringConverter { public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true; public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { var names = new List(); try { var devices = CoreManager.Camera.Devices; if (devices != null) { names = devices.Select(d => d.Name).Where(n => !string.IsNullOrEmpty(n)).ToList(); } } catch { } return new StandardValuesCollection(names); } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => false; } }