using Autofac; using Bro.Common.Helper; using Bro.Common.Interface; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Bro.Common.Model { public class DeviceSelectorConverter : ComboBoxItemTypeConvert //where T : IDevice { public override Hashtable GetConvertHash(ITypeDescriptorContext context) { Hashtable table = new Hashtable(); using (var scope = GlobalVar.Container.BeginLifetimeScope()) { List deviceList = scope.Resolve>(); deviceList.Where(d => d is T).ToList().ForEach(d => { table[d.Id] = d.Name; }); } return table; } } }