Пример #1
0
        /// <summary>
        /// Assigns an enum value to the value structure. This
        /// allows to pass enum values to methods and constructors
        /// to ensure that method signatures match properly
        /// </summary>
        /// <param name="enumValue">full type and value name. Example: System.Windows.Forms.MessageBoxOptions.OK</param>
        public void SetEnum(string enumValue)
        {
            if (string.IsNullOrEmpty(enumValue))
            {
                throw new ArgumentNullException("Enum type is not set.");
            }

            int at = enumValue.LastIndexOf('.');

            if (at == -1)
            {
                throw new ArgumentException("Invalid format for enum value.");
            }

            string type     = enumValue.Substring(0, at);
            string property = enumValue.Substring(at + 1);

            var bridge = new wwDotNetBridge();

            Value = bridge.GetStaticProperty(type, property);
        }
Пример #2
0
        public void SetValueFromEnum(string enumType, string enumName)
        {
            wwDotNetBridge bridge = new wwDotNetBridge();

            Value = bridge.GetStaticProperty(enumType, enumName);
        }
Пример #3
0
        /// <summary>
        /// Sets the value property from a static property retrieved from .NET.
        /// Useful to transfer value in .NET that are marshalled incorrectly
        /// in FoxPro such as Enum values (that are marshalled as numbers)
        /// </summary>
        /// <param name="typeName">Full type name as a string - can also be an Enum type</param>
        /// <param name="property">The static property name</param>
        public void SetValueFromStaticProperty(string typeName, string property)
        {
            wwDotNetBridge bridge = new wwDotNetBridge();

            Value = bridge.GetStaticProperty(typeName, property);
        }