/// <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); }
/// <summary> /// Invokes a static method with the passed parameters and sets the Value property /// from the result value. /// </summary> /// <param name="typeName"></param> /// <param name="method"></param> /// <param name="parms"></param> public void SetValueFromInvokeStaticMethod(string typeName, string method, ComArray parms) { wwDotNetBridge bridge = new wwDotNetBridge(); var list = new List<object>(); if (parms.Instance != null) foreach (object item in parms.Instance as IEnumerable) list.Add(item); Value = bridge.InvokeStaticMethod_Internal(typeName, method, list.ToArray()); }
/// <summary> /// Sets the Value property from a 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="objectRef">An object reference to the base object</param> /// <param name="property">Name of the property</param> public void SetValueFromProperty(object objectRef,string property) { wwDotNetBridge bridge = new wwDotNetBridge(); Value = bridge.GetProperty(objectRef,property); }
public void SetValueFromEnum(string enumType, string enumName) { wwDotNetBridge bridge = new wwDotNetBridge(); Value = bridge.GetStaticProperty(enumType, enumName); }
/// <summary> /// Sets the Value property from a method call that passes it's positional arguments /// as an array. /// </summary> /// <param name="objectRef">Object instance</param> /// <param name="method">Method to call</param> /// <param name="parms">An array of the parameters passed (use ComArray and InvokeMethod)</param> public void SetValueFromInvokeMethod(object objectRef, string method, object[] parms) { wwDotNetBridge bridge = new wwDotNetBridge(); Value = bridge.InvokeMethodWithParameterArray(objectRef, method, parms); }
/// <summary> /// Sets the Value property from a CreateInstance call. Useful for /// value types that can't be passed back to FoxPro. /// </summary> /// <param name="typeName"></param> /// <param name="parms"></param> public void SetValueFromCreateInstance(string typeName, object[] parms) { wwDotNetBridge bridge = new wwDotNetBridge(); Value = bridge.CreateInstance_Internal(typeName, parms); }
/// <summary> /// Assigns an enum value that is based on a numeric (flag) value /// or a combination of flag values. /// </summary> /// <param name="enumType">Enum type name (System.Windows.Forms.MessageBoxOptions)</param> /// <param name="enumValue">numeric flag value to set enum to</param> public void SetEnumFlag(string enumType, int enumValue) { if (string.IsNullOrEmpty(enumType)) throw new ArgumentNullException("Enum type is not set."); var bridge = new wwDotNetBridge(); Type type = bridge.GetTypeFromName(enumType); Value = Enum.ToObject(type, enumValue); }
/// <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); }
public object GetValue() { var bridge = new wwDotNetBridge(); return bridge.GetProperty(this,"Value"); }
/// <summary> /// Method that sets the Value property by fixing up any /// values based on GetProperty() rules. This means if you pass /// an ComArray the raw array will be unpacked and stored for example. /// </summary> public void SetValue(object value) { object obj = this; wwDotNetBridge bridge = new wwDotNetBridge(); bridge.SetProperty(obj,"Value",value); }