private void InitializeSignatureAlgorithm() { foreach (NSTableColumn column in SignAlgorithmTableView.TableColumns()) { SignAlgorithmTableView.RemoveColumn(column); } SignAlgorithmTableView.Delegate = new TableDelegate(); var listView = new SignatureAlgorithmDataSource { Entries = RelyingPartyDto.SignatureAlgorithms }; var columnNames = new List <ColumnOptions> { new ColumnOptions { Id = "MaxKeySize", DisplayName = "Max Key Size", DisplayOrder = 1, Width = 80 }, new ColumnOptions { Id = "MinKeySize", DisplayName = "Min Key Size", DisplayOrder = 2, Width = 80 }, new ColumnOptions { Id = "Priority", DisplayName = "Priority", DisplayOrder = 3, Width = 80 } }; var columns = ListViewHelper.ToNSTableColumns(columnNames); foreach (var column in columns) { SignAlgorithmTableView.AddColumn(column); } SignAlgorithmTableView.DataSource = listView; SignAlgorithmTableView.ReloadData(); }
public void OnAddSignatureAlgorithm(object sender, EventArgs e) { NSApplication.SharedApplication.StopModal(); var form = new AddNewSignatureAlgorithmController(); NSApplication.SharedApplication.RunModalForWindow(form.Window); if (form.SignatureAlgorithmDto != null) { RelyingPartyDto.SignatureAlgorithms.Add(form.SignatureAlgorithmDto); var datasource = new SignatureAlgorithmDataSource { Entries = RelyingPartyDto.SignatureAlgorithms }; SignAlgorithmTableView.DataSource = datasource; SignAlgorithmTableView.ReloadData(); } }
public void OnRemoveSignatureAlgorithm(object sender, EventArgs e) { if (RelyingPartyDto.SignatureAlgorithms != null && RelyingPartyDto.SignatureAlgorithms.Count > 0) { if (SignAlgorithmTableView.SelectedRows != null && SignAlgorithmTableView.SelectedRows.Count > 0) { foreach (var row in SignAlgorithmTableView.SelectedRows) { if (row > 0 && (int)row < RelyingPartyDto.SignatureAlgorithms.Count) { RelyingPartyDto.SignatureAlgorithms.RemoveAt((int)row); } } var datasource = new SignatureAlgorithmDataSource { Entries = RelyingPartyDto.SignatureAlgorithms }; SignAlgorithmTableView.DataSource = datasource; SignAlgorithmTableView.ReloadData(); } } }
public void OnSignatureAlgorithmUpdate(object sender, EventArgs e) { if (SignAlgorithmTableView.SelectedRows != null && (int)SignAlgorithmTableView.SelectedRows.Count > 0) { var row = (int)SignAlgorithmTableView.SelectedRows.FirstIndex; var dto = RelyingPartyDto.SignatureAlgorithms [row]; NSApplication.SharedApplication.StopModal(); var form = new AddNewSignatureAlgorithmController() { SignatureAlgorithmDto = dto }; NSApplication.SharedApplication.RunModalForWindow(form.Window); if (form.IsUpdated != null) { RelyingPartyDto.SignatureAlgorithms.RemoveAt(row); RelyingPartyDto.SignatureAlgorithms.Add(form.SignatureAlgorithmDto); var datasource = new SignatureAlgorithmDataSource { Entries = RelyingPartyDto.SignatureAlgorithms }; SignAlgorithmTableView.DataSource = datasource; SignAlgorithmTableView.ReloadData(); } } }