private void PrePopulateFields()
        {
            var tenant = MiscUtil.GetBrandConfig(CommonConstants.TENANT);

            BindDN.StringValue = string.IsNullOrWhiteSpace(_dto.BindDN) ?"Administrator@" + tenant:_dto.BindDN;
            BaseDN.StringValue = string.IsNullOrWhiteSpace(_dto.BaseDN)?CommonConstants.GetDNFormat(tenant):_dto.BaseDN;
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            //Events
            this.BtnAdd.Activated   += OnClickAddButton;
            this.BtnClose.Activated += (object sender, EventArgs e) => {
                this.Close();
                NSApplication.SharedApplication.StopModalWithCode(0);
            };
            this.CbSaml.Activated += (object sender, EventArgs e) => {
                var legacy = this.CbSaml.StringValue == "1";
                this.TxtStsEndpoint.Hidden = !legacy;
                this.LblStsEndpoint.Hidden = !legacy;
                SetUrl(this, EventArgs.Empty);
            };
            this.CbSsl.Activated        += SetUrl;
            this.TxtServer.Changed      += SetUrl;
            this.TxtPort.Changed        += SetUrl;
            this.TxtStsEndpoint.Changed += SetUrl;
            this.TxtTenant.Changed      += SetUrl;
            this.TxtStsEndpoint.Changed += SetUrl;

            _changeServer = ServerDto != null && !string.IsNullOrEmpty(ServerDto.ServerName);
            if (_changeServer)
            {
                this.TxtServer.StringValue      = ServerDto.ServerName;
                this.TxtPort.StringValue        = ServerDto.Port;
                this.TxtTenant.StringValue      = ServerDto.Tenant;
                this.TxtStsEndpoint.StringValue = string.IsNullOrEmpty(ServerDto.StsUrl) ?  "sts/STSService" : ServerDto.StsUrl;
                this.CbSaml.StringValue         = ServerDto.TokenType == TokenType.SAML ? "1" : "0";
                this.LblStsEndpoint.Hidden      = ServerDto.TokenType == TokenType.Bearer;
                this.TxtStsEndpoint.Hidden      = ServerDto.TokenType == TokenType.Bearer;
            }
            else
            {
                this.TxtStsEndpoint.StringValue = "sts/STSService";
                this.TxtPort.StringValue        = "443";
                this.TxtTenant.StringValue      = MiscUtil.GetBrandConfig(CommonConstants.TENANT);
                this.CbSaml.StringValue         = "0";
                this.LblStsEndpoint.Hidden      = true;
                this.TxtStsEndpoint.Hidden      = true;
            }
            SetUrl(this, EventArgs.Empty);
        }