public IObjectReference Resolve(Guid riid) { ExceptionHelpers.ThrowExceptionForHR(_obj.Vftbl.Resolve(ThisPtr, ref riid, out IntPtr ptr)); try { return(ComWrappersSupport.GetObjectReferenceForInterface(ptr)); } finally { MarshalInspectable.DisposeAbi(ptr); } }
protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { IObjectReference objRef = ComWrappersSupport.GetObjectReferenceForInterface(externalComObject); if (objRef.TryAs <IInspectable.Vftbl>(out var inspectableRef) == 0) { IInspectable inspectable = new IInspectable(inspectableRef); string runtimeClassName = inspectable.GetRuntimeClassName(noThrow: true); if (runtimeClassName == null) { // If the external IInspectable has not implemented GetRuntimeClassName, // we use the Inspectable wrapper directly. return(inspectable); } return(ComWrappersSupport.GetTypedRcwFactory(runtimeClassName)(inspectable)); }
public IObjectReference Resolve(Guid riid) { ExceptionHelpers.ThrowExceptionForHR(_obj.Vftbl.Resolve(ThisPtr, ref riid, out IntPtr objRef)); return(ComWrappersSupport.GetObjectReferenceForInterface(objRef)); }
public Language(string languageTag) : this(((Func <global::MS.Internal.WindowsRuntime.ABI.Windows.Globalization.ILanguage>)(() => { IntPtr ptr = (_ILanguageFactory.Instance.CreateLanguage(languageTag)); try { return(new global::MS.Internal.WindowsRuntime.ABI.Windows.Globalization.ILanguage(ComWrappersSupport.GetObjectReferenceForInterface(ptr))); } finally { MarshalInspectable.DisposeAbi(ptr); } }))()) { ComWrappersSupport.RegisterObjectForInterface(this, ThisPtr); }