public object InvokeMethod(string methodName, params object[] parameters) { NetVariantList variantParameters = null; if (parameters != null && parameters.Length > 0) { variantParameters = new NetVariantList(); foreach (var parameter in parameters) { using (var variantParameter = NetVariant.From(parameter)) { variantParameters.Add(variantParameter); } } } using (variantParameters) using (var result = _qObject.InvokeMethod(methodName, variantParameters)) { if (result == null) { return(null); } object unpacked = null; Helpers.Unpackvalue(ref unpacked, result); result.Dispose(); return(unpacked); } }
public object Call(params object[] parameters) { NetVariantList variants = null; if (parameters != null && parameters.Length > 0) { variants = new NetVariantList(); foreach (var parameter in parameters) { using (var variant = new NetVariant()) { Helpers.PackValue(parameter, variant); variants.Add(variant); } } } var result = Call(variants); variants?.Dispose(); if (result == null) { return(null); } object returnValue = null; Helpers.Unpackvalue(ref returnValue, result); result.Dispose(); return(returnValue); }
public void SetProperty(string propertyName, NetVariant value) { byte wasSuccessful = 0; Interop.NetQObject.SetProperty(Handle, propertyName, value?.Handle ?? IntPtr.Zero, ref wasSuccessful); if (wasSuccessful == 0) { throw new Exception("Setting property failed."); } }
public void SetProperty(string propertyName, object value) { if (value == null) { _jsValue.SetProperty(propertyName, null); } else { using (var variant = new NetVariant()) { Helpers.Pack(value, variant, value.GetType()); _jsValue.SetProperty(propertyName, variant); } } }
public void SetProperty(string propertyName, object value) { if (value == null) { _qObject.SetProperty(propertyName, null); } else { using (var variant = new NetVariant()) { Helpers.PackValue(value, variant); _qObject.SetProperty(propertyName, variant); } } }
public override bool TrySetMember(SetMemberBinder binder, object value) { if (value == null) { _jsValue.SetProperty(binder.Name, null); } else { using (var variant = new NetVariant()) { Helpers.PackValue(value, variant); _jsValue.SetProperty(binder.Name, variant); } } return(true); }
public void SetProperty(string propertyName, NetVariant value) { Interop.NetJsValue.SetProperty(Handle, propertyName, value?.Handle ?? IntPtr.Zero); }
public void Add(NetVariant variant) { Interop.NetVariantList.Add(Handle, variant.Handle); }