示例#1
0
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
        {
            if ((value == null))
            {
                return(null);
            }
            ConductorMaterialKind valueCasted = ((ConductorMaterialKind)(value));

            if ((valueCasted == ConductorMaterialKind.Steel))
            {
                return("steel");
            }
            if ((valueCasted == ConductorMaterialKind.Other))
            {
                return("other");
            }
            if ((valueCasted == ConductorMaterialKind.Aluminum))
            {
                return("aluminum");
            }
            if ((valueCasted == ConductorMaterialKind.Copper))
            {
                return("copper");
            }
            if ((valueCasted == ConductorMaterialKind.Acsr))
            {
                return("acsr");
            }
            throw new ArgumentOutOfRangeException("value");
        }
示例#2
0
        public override void SetProperty(Property property)
        {
            switch (property.Id)
            {
            case ModelCode.CONDUCTOR_CONMATERIAL:
                conductorMaterial = (ConductorMaterialKind)property.AsEnum();
                break;

            case ModelCode.CONDUCTOR_LEN:
                length = property.AsFloat();
                break;

            default:
                base.SetProperty(property);
                break;
            }
        }