public PromptHelper(IWin32Window owner, string username, string password, ICredentialsDomain domain)
 {
     _owner    = owner;
     _username = username;
     _password = password;
     _domain   = domain;
 }
 public PromptHelper(IWin32Window owner, string username, string password, ICredentialsDomain domain)
 {
     _owner = owner;
     _username = username;
     _password = password;
     _domain = domain;
 }
        public static CredentialsPromptResult PromptForCredentials(ref string username, ref string password, ICredentialsDomain domain)
        {
            CredentialsPromptResult result;

            if (BlogClientUIContext.SilentModeForCurrentThread)
                return CredentialsPromptResult.Abort;

            IBlogClientUIContext uiContext = BlogClientUIContext.ContextForCurrentThread;
            if (uiContext != null)
            {
                PromptHelper promptHelper = new PromptHelper(uiContext, username, password, domain);
                if (uiContext.InvokeRequired)
                    uiContext.Invoke(new InvokeInUIThreadDelegate(promptHelper.ShowPrompt), new object[0]);
                else
                {
                    promptHelper.ShowPrompt();

                    //force a UI loop so that the dialog closes without hanging while post-dialog logic executes
                    Application.DoEvents();
                }

                result = promptHelper.Result;
                if (result != CredentialsPromptResult.Cancel)
                {
                    username = promptHelper.Username;
                    password = promptHelper.Password;
                }
            }
            else
            {
                result = CredentialsPromptResult.Abort;
            }
            return result;
        }
Esempio n. 4
0
 public BlogCredentials(SettingsPersisterHelper settingsRoot, ICredentialsDomain domain)
 {
     _settingsRoot = settingsRoot;
     _domain = domain;
 }
        public static CredentialsPromptResult PromptForCredentials(ref string username, ref string password, ICredentialsDomain domain)
        {
            CredentialsPromptResult result;

            if (BlogClientUIContext.SilentModeForCurrentThread)
            {
                return(CredentialsPromptResult.Abort);
            }

            IBlogClientUIContext uiContext = BlogClientUIContext.ContextForCurrentThread;

            if (uiContext != null)
            {
                PromptHelper promptHelper = new PromptHelper(uiContext, username, password, domain);
                if (uiContext.InvokeRequired)
                {
                    uiContext.Invoke(new InvokeInUIThreadDelegate(promptHelper.ShowPrompt), new object[0]);
                }
                else
                {
                    promptHelper.ShowPrompt();

                    //force a UI loop so that the dialog closes without hanging while post-dialog logic executes
                    Application.DoEvents();
                }

                result = promptHelper.Result;
                if (result != CredentialsPromptResult.Cancel)
                {
                    username = promptHelper.Username;
                    password = promptHelper.Password;
                }
            }
            else
            {
                result = CredentialsPromptResult.Abort;
            }
            return(result);
        }
 public BlogCredentials(SettingsPersisterHelper settingsRoot, ICredentialsDomain domain)
 {
     _settingsRoot = settingsRoot;
     _domain       = domain;
 }