public UInt64 GetUInt64() { UInt64 value = 0; PInvokeUtils.ThrowIfResult(NativeMethods.PropertyValue_GetUInt64(this.Interface, ref value)); return(value); }
private void CreateHelper <T>(T value, CreateValueFunc <T> pInvokeCreate) { IntPtr pValue = IntPtr.Zero; PInvokeUtils.ThrowIfResult(pInvokeCreate(value, ref pValue)); this.SetInterface(pValue); }
public bool GetBoolean() { bool value = false; PInvokeUtils.ThrowIfResult(NativeMethods.PropertyValue_GetBoolean(this.Interface, ref value)); return(value); }
public Int32 GetInt32() { Int32 value = 0; PInvokeUtils.ThrowIfResult(NativeMethods.PropertyValue_GetInt32(this.Interface, ref value)); return(value); }
public DateTime GetDateTime() { long value = 0; PInvokeUtils.ThrowIfResult(NativeMethods.PropertyValue_GetDateTime(this.Interface, ref value)); return(DateTime.FromFileTime(value)); }
public byte GetByte() { byte value = 0; PInvokeUtils.ThrowIfResult(NativeMethods.PropertyValue_GetByte(this.Interface, ref value)); return(value); }
public IntPtr[] GetInspectableArray() { return(PInvokeUtils.GetPtrArray(delegate(ref UInt32 size, ref IntPtr pValues) { return NativeMethods.PropertyValue_GetInspectableArray(this.Interface, ref size, ref pValues); })); }
public String GetString() { return(PInvokeUtils.GetString(delegate(ref IntPtr pStr) { return NativeMethods.PropertyValue_GetString(this.Interface, ref pStr); })); }
internal void AddCallbackEventHandler( IntPtr pInterface, AttachCallbackEventHandlerDelegate pInvokeAttach, OnEventHandlerAdapter <T> callback) { NativeMethods.OnCallbackEventHandler callbackAdapter = (IntPtr pEventArgs) => { try { var ctorInfo = typeof(T).GetTypeInfo().DeclaredConstructors.Single( ci => ci.GetParameters().Length > 0 && ci.GetParameters()[0].ParameterType == typeof(IntPtr)); var eventArgsAdapter = (T)ctorInfo.Invoke(new object[] { pEventArgs }); callback(eventArgsAdapter); } catch (Exception) { return(-1); } return(0); }; IntPtr pEventHandler = IntPtr.Zero; PInvokeUtils.ThrowIfResult(pInvokeAttach(pInterface, callbackAdapter, ref pEventHandler)); this.Callbacks.Value.Add(callback, new Tuple <IntPtr, NativeMethods.OnCallbackEventHandler>(pEventHandler, callbackAdapter)); }
private void CreateArrayHelper <T>(T[] value, CreateArrayValueFunc <T> pInvokeCreate) { IntPtr pValue = IntPtr.Zero; PInvokeUtils.ThrowIfResult(pInvokeCreate((uint)value.Length, value, ref pValue)); this.SetInterface(pValue); }
public InspectableAdapter GetResults() { IntPtr pValue = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.AsyncOperation_GetResults(this.Interface, ref pValue)); return(ObjectStaticsUtil.CreateInspectable(pValue)); }
internal static IntPtr CastToInternal(IntPtr pInterface, Guid iid) { IntPtr pCastInterface = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.Inspectable_CastTo(pInterface, ref iid, ref pCastInterface)); return(pCastInterface); }
public int IndexOf(InspectableAdapter value) { Int32 index = 0; PInvokeUtils.ThrowIfResult(NativeMethods.ObservableCollection_IndexOf(this.Interface, value != null ? value.Interface:IntPtr.Zero, ref index)); return(index); }
public InspectableAdapter GetItem(uint index) { IntPtr pValue = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.ObservableCollection_GetItem(this.Interface, index, ref pValue)); return(ObjectStaticsUtil.CreateInspectable(pValue)); }
public InspectableAdapter GetProperty(uint propertyId) { IntPtr pValue = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.ObjectDispatch_GetProperty(this.Interface, propertyId, ref pValue)); return(ObjectStaticsUtil.CreateInspectable(pValue)); }
public void SetProperty(uint propertyId, InspectableAdapter pValue) { PInvokeUtils.ThrowIfResult(NativeMethods.ObjectDispatch_SetProperty( this.Interface, propertyId, pValue != null ? pValue.Interface:IntPtr.Zero)); }
public static bool IsAvailable() { bool isAvailable = false; PInvokeUtils.ThrowIfResult(NativeMethods.Logger_IsAvailable(ref isAvailable)); return(isAvailable); }
public PropertyTypeInfoAdapter GetResultTypeInfo() { IntPtr pInterface = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.Command_GetResultTypeInfo(this.Interface, ref pInterface)); return(new PropertyTypeInfoAdapter(pInterface)); }
public bool HasKey(string key) { bool result = false; PInvokeUtils.ThrowIfResult(NativeMethods.Dictionary_HasKey(this.Interface, key, ref result)); return(result); }
public InspectableAdapter Lookup(string key) { IntPtr pValue = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.Dictionary_Lookup(this.Interface, key, ref pValue)); return(ObjectStaticsUtil.CreateInspectable(pValue)); }
internal DictionaryAdapter() { IntPtr pInterface = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.Dictionary_CreateInstance(ref pInterface)); this.SetInterface(pInterface); }
internal static Guid GetObjectType(IntPtr pInterface) { Guid type = Guid.Empty; PInvokeUtils.ThrowIfResult(NativeMethods.ObjectStaticsUtil_GetObjectType(pInterface, ref type)); return(type); }
public LoggerLevel GetCategoryLevel(string categoryPath) { UInt32 level = 0; PInvokeUtils.ThrowIfResult(NativeMethods.Logger_GetCategoryLevel(this.Interface, categoryPath, ref level)); return((LoggerLevel)level); }
public bool IsTypeOf(Guid iid) { bool result = false; PInvokeUtils.ThrowIfResult(NativeMethods.Inspectable_IsTypeOf(this.Interface, ref iid, ref result)); return(result); }
public InspectableAdapter[] GetItems() { var items = PInvokeUtils.GetPtrArray(delegate(ref UInt32 size, ref IntPtr pValues) { return(NativeMethods.ObservableCollection_GetItems(this.Interface, ref size, ref pValues)); }); return(ObjectStaticsUtil.CreateInspectableArray(items)); }
public T GetActivationFactory <T>(string activationId) { IntPtr pFactory = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.ActivationFactory_GetFactory( activationId, ref pFactory)); return(GetOrCreateObject(new ObservableObjectAdapter(pFactory)).AssertCast <T>()); }
public InspectableAdapter Execute(InspectableAdapter pParameter) { IntPtr result = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.Command_Execute( this.Interface, pParameter != null ? pParameter.Interface:IntPtr.Zero, ref result)); return(ObjectStaticsUtil.CreateInspectable(result)); }
public bool CanExecute(InspectableAdapter pParameter) { bool canExecute = false; PInvokeUtils.ThrowIfResult(NativeMethods.Command_CanExecute( this.Interface, pParameter != null ? pParameter.Interface : IntPtr.Zero, ref canExecute)); return(canExecute); }
public static ObjectAdapter ActivateObject(Guid iidType, InspectableAdapter pContext) { IntPtr pObject = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.ObjectStaticsUtil_ActivateObject( ref iidType, pContext != null ? pContext.Interface : IntPtr.Zero, ref pObject)); return(CreateObject(pObject, GetObjectType(pObject))); }
static LoggerAdapter() { LazyFoundationInstance = new Lazy <LoggerAdapter>(() => { IntPtr pInterface = IntPtr.Zero; PInvokeUtils.ThrowIfResult(NativeMethods.Logger_GetFoundationInstance(ref pInterface)); return(new LoggerAdapter(pInterface)); }); }