public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            IsUpdated = false;

            //Events
            this.BtnAdd.Activated += (object sender, EventArgs e) => {
                if (string.IsNullOrEmpty(TxtName.StringValue))
                {
                    UIErrorHelper.ShowAlert("Name has invalid value", "Alert");
                }
                else if (string.IsNullOrEmpty(TxtBinding.StringValue))
                {
                    UIErrorHelper.ShowAlert("Binding has invalid value", "Alert");
                }
                else if (string.IsNullOrEmpty(TxtEndpoint.StringValue))
                {
                    UIErrorHelper.ShowAlert("Endpoint has invalid value", "Alert");
                }
                else
                {
                    ServiceEndpointDto = new ServiceEndpointDto
                    {
                        Name     = TxtName.StringValue,
                        Binding  = TxtBinding.StringValue,
                        Endpoint = TxtEndpoint.StringValue
                    };
                    IsUpdated = true;
                    this.Close();
                    NSApplication.SharedApplication.StopModalWithCode(0);
                }
            };
            this.BtnClose.Activated += (object sender, EventArgs e) => {
                this.Close();
                NSApplication.SharedApplication.StopModalWithCode(0);
            };

            if (ServiceEndpointDto != null)
            {
                TxtName.StringValue     = ServiceEndpointDto.Name;
                TxtEndpoint.StringValue = ServiceEndpointDto.Endpoint;
                TxtBinding.StringValue  = ServiceEndpointDto.Binding;
            }
        }
 private void OnAddSloServices(object sender, EventArgs e)
 {
     if (IsSloServiceValid())
     {
         var endpointDto = new ServiceEndpointDto {
             Name     = TxtSloName.StringValue,
             Endpoint = TxtSloEndpoint.StringValue,
             Binding  = TxtSloBinding.StringValue
         };
         ExternalIdentityProviderDto.SloServices.Add(endpointDto);
         var datasource = new ServiceEndpointDataSource {
             Entries = ExternalIdentityProviderDto.SloServices
         };
         LstSlo.DataSource = datasource;
         LstSlo.ReloadData();
         TxtSloName.StringValue     = (NSString)string.Empty;
         TxtSloEndpoint.StringValue = (NSString)string.Empty;
         TxtSloBinding.StringValue  = (NSString)string.Empty;
     }
 }
Example #3
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtName.Text.Trim()))
     {
         MMCDlgHelper.ShowWarning("Enter a valid name");
         return;
     }
     if (string.IsNullOrEmpty(txtEndpoint.Text.Trim()) && !Uri.IsWellFormedUriString(txtEndpoint.Text, UriKind.Absolute))
     {
         MMCDlgHelper.ShowWarning("Enter a valid endpoint");
         return;
     }
     if (string.IsNullOrEmpty(txtBinding.Text.Trim()))
     {
         MMCDlgHelper.ShowWarning("Enter a valid binding");
         return;
     }
     _serviceDto = new ServiceEndpointDto {
         Name = txtName.Text, Endpoint = txtEndpoint.Text, Binding = txtBinding.Text
     };
     DialogResult = DialogResult.OK;
     Close();
 }