public void Initialize([NotNull] IThreatModel model) { var schemaManager = new DefinitionsPropertySchemaManager(model); var propertyType = schemaManager.DefinitionsPropertyType; if (propertyType != null) { var property = model.GetProperty(propertyType) ?? model.AddProperty(propertyType, null); if (property is IPropertyJsonSerializableObject jsonProperty) { var definitions = new DefinitionContainer(); definitions.SetDefinition("Threat Model", "Threat Modeling is a process to understand potential threat events to a system, determine risks from those threats, and establish appropriate mitigations."); definitions.SetDefinition("Threat Events", "Potential attack scenarios to the system. Who performs those attack scenarios is called Threat Actor."); definitions.SetDefinition("Risks", "Potential loss caused by the occurring of a Threat Event. It is typically expressed in monetary terms."); definitions.SetDefinition("Mitigations", "Actions that may decrease the Risk associated to a Threat Event."); jsonProperty.Value = definitions; } } }
private void _data_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!_loading) { var row = _data.Rows[e.RowIndex]; var name = row.Cells[0].Value as string; var value = row.Cells[1].Value as string; _container.SetDefinition(name, value); } }