Exemple #1
0
        private static IResourceType LoadResourceField(System.Xml.XmlNode fieldNode)
        {
            IResourceType field = null;

            switch (fieldNode.Name)
            {
            case "text":
                field = new TextFieldType();
                break;

            case "internal_ref":
                field = new InternalRefFieldType();
                break;


            case "external_ref":
                field = new ExternalRefFieldType();
                break;

            case "numeric":
                field = new NumericFieldType();
                break;

            case "enum":
                field = new EnumFieldType();
                break;
            }

            if (field != null)
            {
                field.LoadFromXML(fieldNode);
            }

            return(field);
        }
 internal EnumFieldValue(ResourceValueList elements, EnumFieldType type)
 {
     _type     = type;
     _elements = elements;
     if (_elements.Count > 0)
     {
         SelectedElementIndex = 0;
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EnumFieldValue"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        public EnumFieldValue(EnumFieldType type)
            : this(new ResourceValueList(), type)
        {
            foreach (EnumElementFieldType elementType in _type.SubTypes.Values)
            {
                _elements.Add(elementType.Name, elementType.CreateDefaultValue());
            }

            if (_elements.Count > 0)
            {
                SelectedElementIndex = 0;
            }
        }
 internal EnumFieldValue(ResourceValueList elements, EnumFieldType type)
 {
     _type = type;
     _elements = elements;
     if (_elements.Count > 0)
         SelectedElementIndex = 0;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EnumFieldValue"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        public EnumFieldValue(EnumFieldType type)
            : this(new ResourceValueList (), type)
        {
            foreach (EnumElementFieldType elementType in _type.SubTypes.Values)
            {
                _elements.Add(elementType.Name, elementType.CreateDefaultValue());
            }

            if (_elements.Count > 0)
                SelectedElementIndex = 0;
        }
        private static IResourceType LoadResourceField(System.Xml.XmlNode fieldNode)
        {
            IResourceType field = null;
            switch (fieldNode.Name)
            {
                case "text":
                    field = new TextFieldType();
                    break;

                case "internal_ref":
                    field = new InternalRefFieldType();
                    break;

                case "external_ref":
                    field = new ExternalRefFieldType();
                    break;

                case "numeric":
                    field = new NumericFieldType();
                    break;

                case "enum":
                    field = new EnumFieldType();
                    break;
            }

            if (field != null)
                field.LoadFromXML(fieldNode);

            return field;
        }