using System.Collections.Generic; using System.ComponentModel; using System.Linq; using TeamAAS.Core; using TeamAAS.Global.Devices; namespace Plugins.Motion.Core { public class MotionCardNameConverter : StringConverter { public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true; public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { var names = new List(); try { var mgr = CoreManager.Motion; if (mgr != null) { names = mgr.Devices.OfType() .Select(c => c.Name) .Where(n => !string.IsNullOrEmpty(n)) .Distinct() .OrderBy(n => n) .ToList(); } } catch { } return new StandardValuesCollection(names); } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => false; } }