private bool EditSharePointCredentialConnection(IWin32Window parentWindow, Connections connections)
        {
            using (CredentialConnectionManagerForm form = new CredentialConnectionManagerForm())
            {
                form.Initialize(this._serviceProvider, this.ConnectionManager, this.ErrorCollectionService);

                if (DesignUtils.ShowDialog(form, parentWindow, this._serviceProvider) == DialogResult.OK)
                {
                    if (!this.ConnectionManager.Name.Equals(form.ConnectionName, StringComparison.OrdinalIgnoreCase))
                    {
                        this.ConnectionManager.Name =
                            ConnectionManagerUtils.GetConnectionName(connections, form.ConnectionName);
                    }

                    ConnectionManager.Description = form.ConnectionDescription;

                    CredentialConnectionManager innerManager = (CredentialConnectionManager)ConnectionManager.InnerObject;

                    if (form.CanUseDefaultCredentials)
                    {
                        innerManager.UserName = string.Empty;
                        innerManager.Password = string.Empty;
                    }
                    else
                    {
                        innerManager.UserName = form.UserName;
                        innerManager.Password = form.Password;
                    }

                    return(true);
                }
            }

            return(false);
        }
        private void CredentialConnectionManagerForm_Load(object sender, EventArgs e)
        {
            this.ConnectionName        = this.ConnectionManager.Name;
            this.ConnectionDescription = this.ConnectionManager.Description;

            CredentialConnectionManager innerManager = (CredentialConnectionManager)this.ConnectionManager.InnerObject;

            if (innerManager.UserName.Length == 0)
            {
                this.rdoUseDefaultCredentials.Checked = true;
                this.UserName = string.Empty;
                this.Password = string.Empty;
            }
            else
            {
                this.rdoUseCustomCredentials.Checked = true;
                this.UserName = innerManager.UserName;
                this.Password = innerManager.GetPassword();
            }
        }