예제 #1
0
 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);
     }
 }
예제 #2
0
        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));
            }
예제 #3
0
 public IObjectReference Resolve(Guid riid)
 {
     ExceptionHelpers.ThrowExceptionForHR(_obj.Vftbl.Resolve(ThisPtr, ref riid, out IntPtr objRef));
     return(ComWrappersSupport.GetObjectReferenceForInterface(objRef));
 }
예제 #4
0
 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);
 }