From e820e1bc0edb86f60cf8d13e69d338d0518a76fa Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 21 Sep 2010 15:28:21 +0000 Subject: [PATCH] Added IncorrectPassword for windows versions newer as Windows XP git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@883 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotCore/Helpers/CredentialsHelper.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/GreenshotCore/Helpers/CredentialsHelper.cs b/GreenshotCore/Helpers/CredentialsHelper.cs index 256fd1cc3..75e8abe38 100644 --- a/GreenshotCore/Helpers/CredentialsHelper.cs +++ b/GreenshotCore/Helpers/CredentialsHelper.cs @@ -29,6 +29,7 @@ using System.Windows.Forms; /// /// The following code comes from: http://www.developerfusion.com/code/4693/using-the-credential-management-api/ /// and is slightly modified so it works for us. +/// Oh, try Start-> Run and type "Control keymgr.dll" to see your usernames and passwords /// The following code is an example for a login, it will call the Authenticate with user/password /// which should return true if the login worked, false if not. /// private static bool Login(string system, string name) { @@ -45,6 +46,7 @@ using System.Windows.Forms; /// } catch (ApplicationException) { /// // exception handling ... /// } +/// dialog.IncorrectPassword = true; /// } /// } /// } catch (ApplicationException) { @@ -132,6 +134,17 @@ namespace Greenshot.Helpers { } } + private bool _incorrectPassword = false; + /// Gets or sets if the incorrect password balloontip needs to be shown. Introduced AFTER Windows XPGets> + public bool IncorrectPassword { + get { + return _incorrectPassword; + } + set { + _incorrectPassword = value; + } + } + private bool _keepName = false; /// Gets or sets if the name is read-only. public bool KeepName { @@ -440,6 +453,10 @@ namespace Greenshot.Helpers { private CREDUI.FLAGS GetFlags() { CREDUI.FLAGS flags = CREDUI.FLAGS.GENERIC_CREDENTIALS; + if (this.IncorrectPassword) { + flags = flags | CREDUI.FLAGS.INCORRECT_PASSWORD; + } + if (this.AlwaysDisplay) { flags = flags | CREDUI.FLAGS.ALWAYS_SHOW_UI; }