Ejemplo n.º 1
0
        public static IAsyncOperation <WebTokenRequestResult> RequestTokenForWindowAsync(IntPtr hWnd, WebTokenRequest request)
        {
            IWebAuthenticationCoreManagerInterop webAuthenticationCoreManagerInterop =
                WebAuthenticationCoreManager.As <IWebAuthenticationCoreManagerInterop>();
            Guid guid = WinRT.GuidGenerator.CreateIID(typeof(IAsyncOperation <WebTokenRequestResult>));

            var requestPtr = MarshalInspectable <WebTokenRequest> .FromManaged(request);

            webAuthenticationCoreManagerInterop.RequestTokenForWindowAsync(
                hWnd,
                requestPtr,
                ref guid,
                out IntPtr result);

            return(MarshalInterface <IAsyncOperation <WebTokenRequestResult> > .FromAbi(result));
        }
Ejemplo n.º 2
0
        public static IAsyncAction ShowAddAccountForWindowAsync(IntPtr hWnd)
        {
            IWebAuthenticationCoreManagerInterop webAuthenticationCoreManagerInterop =
                WebAuthenticationCoreManager.As <IWebAuthenticationCoreManagerInterop>();

            IAccountsSettingsPaneInterop accountsSettingsPaneInterop =
                AccountsSettingsPane.As <IAccountsSettingsPaneInterop>();
            //Guid guid = typeof(IAsyncAction).GUID;
            Guid guid = WinRT.GuidGenerator.CreateIID(typeof(IAsyncAction));

            //IAccountsSettingsPaneInterop accountsSettingsPaneInterop =
            //    (IAccountsSettingsPaneInterop)WindowsRuntimeMarshal.GetActivationFactory(typeof(AccountsSettingsPane));
            //Guid guid = typeof(IAsyncAction).GUID;

            accountsSettingsPaneInterop.ShowAddAccountForWindowAsync(hWnd, ref guid, out IntPtr result);

            return(MarshalInterface <IAsyncAction> .FromAbi(result));
        }