public void ShowPrompt()
            {
                using (BlogClientLoginDialog form = new BlogClientLoginDialog())
                {
                    if (_username != null)
                    {
                        form.UserName = _username;
                    }
                    if (_password != null)
                    {
                        form.Password = _password;
                    }
                    if (_domain != null)
                    {
                        form.Domain = _domain;
                        form.Text   = form.Text + " - " + _domain.Name;
                    }

                    DialogResult dialogResult = form.ShowDialog(_owner);
                    if (dialogResult == DialogResult.OK)
                    {
                        _username = form.UserName;
                        _password = form.Password;
                        _result   = form.SavePassword
                                                                ? CredentialsPromptResult.SaveUsernameAndPassword
                                                                : CredentialsPromptResult.SaveUsername;
                    }
                    else
                    {
                        _result = CredentialsPromptResult.Cancel;
                    }
                }
            }
            public void ShowPrompt()
            {
                using (BlogClientLoginDialog form = new BlogClientLoginDialog())
                {
                    if (_username != null)
                        form.UserName = _username;
                    if (_password != null)
                        form.Password = _password;
                    if (_domain != null)
                    {
                        form.Domain = _domain;
                        form.Text = form.Text + " - " + _domain.Name;
                    }

                    DialogResult dialogResult = form.ShowDialog(_owner);
                    if (dialogResult == DialogResult.OK)
                    {
                        _username = form.UserName;
                        _password = form.Password;
                        _result = form.SavePassword
                                    ? CredentialsPromptResult.SaveUsernameAndPassword
                                    : CredentialsPromptResult.SaveUsername;
                    }
                    else
                        _result = CredentialsPromptResult.Cancel;
                }
            }
Beispiel #3
0
        public bool Login(bool showUI, IWin32Window parent)
        {
            if (!showUI) return false;

            BlogClientLoginDialog d = new BlogClientLoginDialog();
            d.Domain = new CredentialsDomain(Res.Get(StringId.Plugin_Video_Youtube_Publish_Name), String.Empty, null, ImageHelper.GetBitmapBytes(ResourceHelper.LoadAssemblyResourceBitmap("Video.YouTube.Images.YouTubeTab.png")), false);
            d.Closing += delegate (object sender, CancelEventArgs e)
                             {
                                 if (d.DialogResult == DialogResult.OK)
                                 {
                                     if (string.IsNullOrEmpty(d.UserName) || string.IsNullOrEmpty(d.Password))
                                     {
                                         DisplayMessage.Show(MessageId.UsernameAndPasswordRequired, this, null);
                                         e.Cancel = true;
                                     }
                                     else if (!Login(d.UserName, d.Password))
                                     {
                                         e.Cancel = true;
                                     }
                                 }

                             };

            d.ShowDialog(parent);

            OnLoginStatusChanged();
            return IsLoggedIn;
        }