From 2e9e21aee6806063bdb763ed8278c6f25b66c577 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Thu, 17 Oct 2024 07:41:11 +1100 Subject: [PATCH] Add ReloadUserTiles method and update IsAutoLogon property - Added ReloadUserTiles method to CredentialProviderBase to notify LogonUI of tile modifications. - Introduced private field isAutoLogon in CredentialTile. - Updated IsAutoLogon property in CredentialTile to use a backing field and call ReloadUserTiles on set. - Corrected typo in XML documentation for CreateParentWindowHwnd method. --- .../CredentialProviderBase.cs | 8 ++++++++ src/Lithnet.CredentialProvider/CredentialTile.cs | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Lithnet.CredentialProvider/CredentialProviderBase.cs b/src/Lithnet.CredentialProvider/CredentialProviderBase.cs index 3568fb1..7501830 100644 --- a/src/Lithnet.CredentialProvider/CredentialProviderBase.cs +++ b/src/Lithnet.CredentialProvider/CredentialProviderBase.cs @@ -114,6 +114,14 @@ namespace Lithnet.CredentialProvider /// Gets a value that indicates if the credential provider should show a generic tile. That is, a tile that is not associated with a specific user. /// public abstract bool ShouldIncludeGenericTile(); + + /// + /// Notifies LogonUI that one of more of the tile items has been modified, and should be reloaded + /// + public void ReloadUserTiles() + { + this.NotifyHostOfTileCollectionChange(); + } /// /// Adds additional user tiles to the collection, and notifies LogonUI that new tiles are available diff --git a/src/Lithnet.CredentialProvider/CredentialTile.cs b/src/Lithnet.CredentialProvider/CredentialTile.cs index 9afcac7..f756f59 100644 --- a/src/Lithnet.CredentialProvider/CredentialTile.cs +++ b/src/Lithnet.CredentialProvider/CredentialTile.cs @@ -15,6 +15,7 @@ namespace Lithnet.CredentialProvider private protected ICredentialProviderCredentialEvents2 events2; private protected ControlCollection controls; + private bool isAutoLogon; protected CredentialTile(CredentialProviderBase credentialProvider) { @@ -37,7 +38,16 @@ namespace Lithnet.CredentialProvider /// /// Gets a value that indicates if the user should be automatically logged on when the tile is selected. The tile must also have IsDefault set to true. /// - public bool IsAutoLogon { get; set; } + public bool IsAutoLogon + { + get => this.isAutoLogon; + set + { + this.isAutoLogon = value; + this.CredentialProvider.ReloadUserTiles(); + + } + } /// /// Gets a value indicating if this should be the default time @@ -87,7 +97,7 @@ namespace Lithnet.CredentialProvider /// Gets the HWND of the parent of the credential provider, and notifies LogonUI or CredUI that we need to create a Window /// /// A HWND to the parentobject - /// The method was called before the host has advised that is ready to rpovide events + /// The method was called before the host has advised that is ready to provide events /// The request to obtain the parent window HWND failed public IntPtr CreateParentWindowHwnd() {