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 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;
        }