领胜LDS 键盘AOI检测项目
xcd
2020-06-27 998ad559883116280541553b761221bd8d486b9e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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<T> : ComboBoxItemTypeConvert //where T : IDevice
    {
        public override Hashtable GetConvertHash(ITypeDescriptorContext context)
        {
            Hashtable table = new Hashtable();
            using (var scope = GlobalVar.Container.BeginLifetimeScope())
            {
                List<IDevice> deviceList = scope.Resolve<List<IDevice>>();
 
                deviceList.Where(d => d is T).ToList().ForEach(d =>
                  {
                      table[d.Id] = d.Name;
                  });
            }
 
            return table;
        }
    }
}