Created
May 24, 2023 17:09
-
-
Save DHowett/7e5c1187da7c33d85edb3da35d35c1c3 to your computer and use it in GitHub Desktop.
Revisions
-
DHowett created this gist
May 24, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ using Windows.Security.Credentials; using WinRT; namespace CredentialCsWinRtTest { internal class Program { static void Main(string[] args) { Windows.Security.Credentials.WebAccount foo = null /* or somehow get it */; Windows.Security.Credentials.IWebAccount2 webAccount2 = foo.As<IWebAccount2>(); // if webaccount2 is not null . . . webAccount2.SignOutAsync("clientId"); // do something with the async task actually } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net7.0-windows10.0.22000.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <!-- **** IMPORTANT 1 - Add the Windows.Security namespace to the list of generated projections --> <CsWinRtIncludes>Windows.Security</CsWinRtIncludes> </PropertyGroup> <ItemGroup> <!-- **** IMPORTANT 2 - This generates the projections --> <PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.2" /> </ItemGroup> </Project>