public void ApplyTo([NotNull] ITrustBoundary trustBoundary) { trustBoundary.ClearProperties(); this.CloneProperties(trustBoundary); if (trustBoundary is TrustBoundary internalTb) { internalTb._templateId = Id; internalTb._template = this; } }
public ITrustBoundary CreateTrustBoundary([Required] string name) { ITrustBoundary result = _model.AddTrustBoundary(name, this); if (result != null) { result.Description = Description; this.CloneProperties(result); } return(result); }
private void AddGridRow([NotNull] ITrustBoundary tb, [NotNull] GridPanel panel) { var row = new GridRow( tb.Name); ((INotifyPropertyChanged)tb).PropertyChanged += OnTrustBoundaryPropertyChanged; row.Tag = tb; row.Cells[0].CellStyles.Default.Image = tb.GetImage(ImageSize.Small); for (int i = 0; i < row.Cells.Count; i++) { row.Cells[i].PropertyChanged += OnPropertyChanged; } AddSuperTooltipProvider(tb, row.Cells[0]); panel.Rows.Add(row); }
private GridRow GetRow([NotNull] ITrustBoundary tb) { GridRow result = null; var rows = _grid.PrimaryGrid.Rows.OfType <GridRow>().ToArray(); foreach (var row in rows) { if (row.Tag == tb) { result = row; break; } } return(result); }
private bool IsSelected([NotNull] ITrustBoundary item, string filter, TrustBoundaryListFilter filterSpecial) { bool result; if (string.IsNullOrWhiteSpace(filter)) { result = true; } else { result = (!string.IsNullOrWhiteSpace(item.Name) && item.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrWhiteSpace(item.Description) && item.Description.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0); if (!result && (item.Properties?.Any() ?? false)) { var properties = item.Properties.ToArray(); foreach (var property in properties) { var stringValue = property.StringValue; if ((!string.IsNullOrWhiteSpace(stringValue) && stringValue.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)) { result = true; break; } } } } if (result) { switch (filterSpecial) { case TrustBoundaryListFilter.NoDiagram: result = _model.Diagrams?.All(x => x.Groups?.All(y => y.AssociatedId != item.Id) ?? true) ?? true; break; } } return(result); }
private void HandleGroupShapeEvent([NotNull] ITrustBoundary trustBoundary) { var row = GetRow(trustBoundary); if (row == null) { var filter = _filter.Text; var filterSpecial = EnumExtensions.GetEnumValue <TrustBoundaryListFilter>((string)_specialFilter.SelectedItem); if (IsSelected(trustBoundary, filter, filterSpecial)) { AddGridRow(trustBoundary, _grid.PrimaryGrid); } } else { var filter = _filter.Text; var filterSpecial = EnumExtensions.GetEnumValue <TrustBoundaryListFilter>((string)_specialFilter.SelectedItem); if (!IsSelected(trustBoundary, filter, filterSpecial)) { row.GridPanel.Rows.Remove(row); } } }
public ITrustBoundaryTemplate AddTrustBoundaryTemplate([Required] string name, string description, ITrustBoundary source = null) { var result = new TrustBoundaryTemplate(this, name) { Description = description, }; source.CloneProperties(result); Add(result); return(result); }