private void InitializeAttributeConsumerServices() { foreach(NSTableColumn column in AttributeTableView.TableColumns()) { AttributeTableView.RemoveColumn (column); } AttributeTableView.Delegate = new TableDelegate (); var listView = new AttributeConsumerServiceDataSource { Entries = RelyingPartyDto.AttributeConsumerServices }; var columnNames = new List<ColumnOptions> { new ColumnOptions{ Id = "Name", DisplayName = "Name", DisplayOrder = 1, Width = 80 }, new ColumnOptions{ Id = "Index", DisplayName = "Index", DisplayOrder = 2, Width = 80 }, new ColumnOptions{ Id = "IsDefault", DisplayName = "Default", DisplayOrder = 3, Width = 80 } }; var columns = ListViewHelper.ToNSTableColumns (columnNames); foreach (var column in columns) { AttributeTableView.AddColumn (column); } AttributeTableView.DataSource = listView; AttributeTableView.ReloadData (); }
public void OnRemoveAttributeServices (object sender, EventArgs e) { if (RelyingPartyDto.AttributeConsumerServices != null && RelyingPartyDto.AttributeConsumerServices.Count > 0) { if (AttributeTableView.SelectedRows != null && AttributeTableView.SelectedRows.Count > 0) { foreach (var row in AttributeTableView.SelectedRows) { if (row >= 0 && (int)row < RelyingPartyDto.AttributeConsumerServices.Count) 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 (); } }
public void OnAttributeUpdate (object sender, EventArgs e) { if (AttributeTableView.SelectedRows != null && (int)AttributeTableView.SelectedRows.Count > 0) { var row = (int)AttributeTableView.SelectedRows.FirstIndex; var dto = RelyingPartyDto.AttributeConsumerServices [row]; NSApplication.SharedApplication.StopModal (); var defaultExists = RelyingPartyDto.AttributeConsumerServices.Exists (x => x.IsDefault); var form = new AddNewAttributeConsumerServiceController (){ DefaultSet = defaultExists, AttributeConsumerServiceDto = dto }; NSApplication.SharedApplication.RunModalForWindow (form.Window); if (form.IsUpdated != null) { RelyingPartyDto.AttributeConsumerServices.RemoveAt (row); RelyingPartyDto.AttributeConsumerServices.Add (form.AttributeConsumerServiceDto); var datasource = new AttributeConsumerServiceDataSource { Entries = RelyingPartyDto.AttributeConsumerServices }; AttributeTableView.DataSource = datasource; AttributeTableView.ReloadData (); } } }