public void OnRemoveAttributeServices(object sender, EventArgs e)
 {
     if (AttributeTableView.SelectedRows != null && AttributeTableView.SelectedRows.Count > 0)
     {
         foreach (var row in AttributeTableView.SelectedRows)
         {
             RelyingPartyDto.AttributeConsumerServices.RemoveAt((int)row);
         }
         var datasource = new AttributeConsumerServiceDataSource {
             Entries = RelyingPartyDto.AttributeConsumerServices
         };
         AttributeTableView.DataSource = datasource;
         AttributeTableView.ReloadData();
     }
 }
        public void OnAddAttributeServices(object sender, EventArgs e)
        {
            NSApplication.SharedApplication.StopModal();
            var defaultExists = RelyingPartyDto.AttributeConsumerServices.Exists(x => x.IsDefault);
            var form          = new AddNewAttributeConsumerServiceController()
            {
                DefaultSet = defaultExists
            };

            NSApplication.SharedApplication.RunModalForWindow(form.Window);
            if (form.AttributeConsumerServiceDto != null)
            {
                RelyingPartyDto.AttributeConsumerServices.Add(form.AttributeConsumerServiceDto);
                var datasource = new AttributeConsumerServiceDataSource {
                    Entries = RelyingPartyDto.AttributeConsumerServices
                };
                AttributeTableView.DataSource = datasource;
                AttributeTableView.ReloadData();
            }
        }
        private void InitializeAttributes()
        {
//			foreach(NSTableColumn column in AttributeTableView.TableColumns())
//			{
//				AttributeTableView.RemoveColumn (column);
//			}

//			AttributeTableView.Delegate = new TableDelegate ();
//			var listView = new AttributeDataSource { Entries = _attributes };
//			var columnNames = new List<ColumnOptions> {
//				new ColumnOptions{ Id = "Name", DisplayName = "Name", DisplayOrder = 1, Width = 80 },
//				new ColumnOptions{ Id = "FriendlyName", DisplayName = "Friendly Name", DisplayOrder = 2, Width = 150 },
//				new ColumnOptions{ Id = "NameFormat", DisplayName = "Name Format", DisplayOrder = 3, Width = 150 }
//			};
//			var columns = ListViewHelper.ToNSTableColumns (columnNames);
//			foreach (var column in columns) {
//				AttributeTableView.AddColumn (column);
//			}
            AttributeTableView.Delegate   = new TableDelegate(this);
            AttributeTableView.DataSource = new AttributeDataSource {
                Entries = _attributes
            };
            AttributeTableView.ReloadData();
        }
        void ReleaseDesignerOutlets()
        {
            if (AssertTableView != null)
            {
                AssertTableView.Dispose();
                AssertTableView = null;
            }

            if (AttributeTableView != null)
            {
                AttributeTableView.Dispose();
                AttributeTableView = null;
            }

            if (BtnAddAssertServices != null)
            {
                BtnAddAssertServices.Dispose();
                BtnAddAssertServices = null;
            }

            if (BtnAddAttributeService != null)
            {
                BtnAddAttributeService.Dispose();
                BtnAddAttributeService = null;
            }

            if (BtnAddSignAlgo != null)
            {
                BtnAddSignAlgo.Dispose();
                BtnAddSignAlgo = null;
            }

            if (BtnApply != null)
            {
                BtnApply.Dispose();
                BtnApply = null;
            }

            if (BtnAddSloService != null)
            {
                BtnAddSloService.Dispose();
                BtnAddSloService = null;
            }

            if (BtnRemoveSloService != null)
            {
                BtnRemoveSloService.Dispose();
                BtnRemoveSloService = null;
            }

            if (BtnBrowseCertificate != null)
            {
                BtnBrowseCertificate.Dispose();
                BtnBrowseCertificate = null;
            }

            if (BtnRemoveAssertService != null)
            {
                BtnRemoveAssertService.Dispose();
                BtnRemoveAssertService = null;
            }

            if (BtnRemoveAttributeService != null)
            {
                BtnRemoveAttributeService.Dispose();
                BtnRemoveAttributeService = null;
            }

            if (BtnRemoveSignAlgo != null)
            {
                BtnRemoveSignAlgo.Dispose();
                BtnRemoveSignAlgo = null;
            }

            if (BtnViewCertificate != null)
            {
                BtnViewCertificate.Dispose();
                BtnViewCertificate = null;
            }

            if (ChkSign != null)
            {
                ChkSign.Dispose();
                ChkSign = null;
            }

            if (SignAlgorithmTableView != null)
            {
                SignAlgorithmTableView.Dispose();
                SignAlgorithmTableView = null;
            }

            if (SloServicesTableView != null)
            {
                SloServicesTableView.Dispose();
                SloServicesTableView = null;
            }

            if (TxtCertificate != null)
            {
                TxtCertificate.Dispose();
                TxtCertificate = null;
            }

            if (TxtRpName != null)
            {
                TxtRpName.Dispose();
                TxtRpName = null;
            }

            if (TxtUrl != null)
            {
                TxtUrl.Dispose();
                TxtUrl = null;
            }
        }
Example #5
0
        void ReleaseDesignerOutlets()
        {
            if (BtnAddAssertServices != null)
            {
                BtnAddAssertServices.Dispose();
                BtnAddAssertServices = null;
            }

            if (BtnAddAttributeServices != null)
            {
                BtnAddAttributeServices.Dispose();
                BtnAddAttributeServices = null;
            }

            if (BtnAddSignatureAlgorithm != null)
            {
                BtnAddSignatureAlgorithm.Dispose();
                BtnAddSignatureAlgorithm = null;
            }

            if (BtnAddSlo != null)
            {
                BtnAddSlo.Dispose();
                BtnAddSlo = null;
            }

            if (AssertionTableView != null)
            {
                AssertionTableView.Dispose();
                AssertionTableView = null;
            }

            if (AttributeTableView != null)
            {
                AttributeTableView.Dispose();
                AttributeTableView = null;
            }

            if (BtnBrowseCertificate != null)
            {
                BtnBrowseCertificate.Dispose();
                BtnBrowseCertificate = null;
            }

            if (SloTableView != null)
            {
                SloTableView.Dispose();
                SloTableView = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnRemoveAssertServices != null)
            {
                BtnRemoveAssertServices.Dispose();
                BtnRemoveAssertServices = null;
            }

            if (BtnRemoveAttributeServices != null)
            {
                BtnRemoveAttributeServices.Dispose();
                BtnRemoveAttributeServices = null;
            }

            if (BtnRemoveSignatureAlgorithm != null)
            {
                BtnRemoveSignatureAlgorithm.Dispose();
                BtnRemoveSignatureAlgorithm = null;
            }

            if (BtnRemoveSlo != null)
            {
                BtnRemoveSlo.Dispose();
                BtnRemoveSlo = null;
            }

            if (BtnSave != null)
            {
                BtnSave.Dispose();
                BtnSave = null;
            }

            if (CbSignAuthRequest != null)
            {
                CbSignAuthRequest.Dispose();
                CbSignAuthRequest = null;
            }

            if (SignAlgoTableView != null)
            {
                SignAlgoTableView.Dispose();
                SignAlgoTableView = null;
            }

            if (TxtCertificate != null)
            {
                TxtCertificate.Dispose();
                TxtCertificate = null;
            }

            if (TxtName != null)
            {
                TxtName.Dispose();
                TxtName = null;
            }

            if (TxtUrl != null)
            {
                TxtUrl.Dispose();
                TxtUrl = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (AttributeTableView != null)
            {
                AttributeTableView.Dispose();
                AttributeTableView = null;
            }

            if (BtnAdd != null)
            {
                BtnAdd.Dispose();
                BtnAdd = null;
            }

            if (BtnAddAttribute != null)
            {
                BtnAddAttribute.Dispose();
                BtnAddAttribute = null;
            }

            if (TxtName != null)
            {
                TxtName.Dispose();
                TxtName = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnRemoveAttribute != null)
            {
                BtnRemoveAttribute.Dispose();
                BtnRemoveAttribute = null;
            }

            if (ChDefault != null)
            {
                ChDefault.Dispose();
                ChDefault = null;
            }

            if (TxtAttributeName != null)
            {
                TxtAttributeName.Dispose();
                TxtAttributeName = null;
            }

            if (TxtFriendlyName != null)
            {
                TxtFriendlyName.Dispose();
                TxtFriendlyName = null;
            }

            if (TxtIndex != null)
            {
                TxtIndex.Dispose();
                TxtIndex = null;
            }

            if (TxtNameFormat != null)
            {
                TxtNameFormat.Dispose();
                TxtNameFormat = null;
            }
        }
Example #7
0
        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(TxtIndex.StringValue))
                {
                    UIErrorHelper.ShowAlert("Index has invalid value", "Alert");
                }
                else if (ChDefault.StringValue == "1" && DefaultSet && (AttributeConsumerServiceDto != null && !AttributeConsumerServiceDto.IsDefault))
                {
                    UIErrorHelper.ShowAlert("Multiple attribute consumer services chosen as default", "Alert");
                }
                else
                {
                    AttributeConsumerServiceDto = new AttributeConsumerServiceDto
                    {
                        Name       = TxtName.StringValue,
                        Index      = TxtIndex.IntValue,
                        IsDefault  = ChDefault.StringValue == "1",
                        Attributes = (AttributeTableView.DataSource as AttributeDataSource).Entries
                    };
                    IsUpdated = true;
                    this.Close();
                    NSApplication.SharedApplication.StopModalWithCode(0);
                }
            };
            this.BtnAddAttribute.Activated += (object sender, EventArgs e) => {
                if (string.IsNullOrEmpty(TxtAttributeName.StringValue))
                {
                    UIErrorHelper.ShowAlert("Attribute name cannot be empty", "Alert");
                    return;
                }
                if (string.IsNullOrEmpty(TxtFriendlyName.StringValue))
                {
                    UIErrorHelper.ShowAlert("Attribute friendly name cannot be empty", "Alert");
                    return;
                }
                if (string.IsNullOrEmpty(TxtNameFormat.StringValue))
                {
                    UIErrorHelper.ShowAlert("Attribute name format cannot be empty", "Alert");
                    return;
                }
                var attributeDto = new AttributeDto
                {
                    Name         = TxtAttributeName.StringValue,
                    FriendlyName = TxtFriendlyName.StringValue,
                    NameFormat   = TxtNameFormat.StringValue
                };
                TxtAttributeName.StringValue = string.Empty;
                TxtFriendlyName.StringValue  = string.Empty;
                TxtNameFormat.StringValue    = string.Empty;
                _attributes.Add(attributeDto);
                AttributeTableView.DataSource = new AttributeDataSource {
                    Entries = _attributes
                };
                AttributeTableView.ReloadData();
            };
            this.BtnRemoveAttribute.Activated += (object sender, EventArgs e) => {
                if (AttributeTableView.SelectedRow > -1)
                {
                    _attributes.RemoveAt((int)AttributeTableView.SelectedRow);
                    AttributeTableView.DataSource = new AttributeDataSource {
                        Entries = _attributes
                    };
                    AttributeTableView.ReloadData();
                }
            };
            this.BtnClose.Activated += (object sender, EventArgs e) => {
                this.Close();
                NSApplication.SharedApplication.StopModalWithCode(0);
            };

            if (AttributeConsumerServiceDto != null)
            {
                TxtName.StringValue   = AttributeConsumerServiceDto.Name;
                _attributes           = AttributeConsumerServiceDto.Attributes;
                ChDefault.StringValue = AttributeConsumerServiceDto.IsDefault ? "1" : "0";
                TxtIndex.IntValue     = AttributeConsumerServiceDto.Index;
            }
            InitializeAttributes();
        }