kingno
6 天以前 6caff8e3b06535a9652a791454135cf0e6ac110e
src/Bro.M141.Process/M141Config.cs
@@ -19,17 +19,18 @@
{
    public class M141Config : ProcessConfigBase
    {
        [Category("打印机配置")]
        [Description("打印机配置集合")]
        [DisplayName("打印机配置集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(ComplexCollectionEditor<Printer>), typeof(UITypeEditor))]
        public List<Printer> Printers { get; set; } = new List<Printer>();
@@ -72,10 +73,41 @@
        [Category("检测异常指示")]
        [Description("选择某个Spec,其表示检测过程中异常")]
        [DisplayName("异常指示标准")]
        [TypeConverter(typeof(SpecCodeSelectorConverter))]
        [TypeConverter(typeof(SpecCodeSelectorConverter))]
        public string CheckErrorSpecCode { get; set; } = "";
        [Category("特定缺陷配置")]
        [Description("S3和S5共同判断缺陷")]
        [DisplayName("缺陷名称")]
        [TypeConverter(typeof(GlobalDefectNameConverter))]
        public string defectname { get; set; } = "";
        private class GlobalDefectNameConverter : StringConverter
        {
            public override bool GetStandardValuesExclusive(ITypeDescriptorContext? context)
            {
                return false;
            }
            public override bool GetStandardValuesSupported(ITypeDescriptorContext? context)
            {
                return true;
            }
            public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context)
            {
                using (var scope = GlobalVar.Container.BeginLifetimeScope())
                {
                    var config = scope.Resolve<IProcessConfig>();
                    return new StandardValuesCollection((config as IDefectSwitcher).DefectSwitchCollection.Select(u => u.DefectName).ToList());
                }
            }
        }
        [Category("位置度设置")]
        [Description("产品测量点位集合")]
        [DisplayName("产品测量点位集合")]