public bool Execute(IThreatTypeMitigation mitigation) { bool result = false; using (var dialog = new MitigationRuleEditDialog()) { if (dialog.Initialize(mitigation)) { result = mitigation.SetRule(dialog); } else { ShowWarning?.Invoke("Threat Event Generation Rule for the related Threat Type has not been set."); } } return(result); }
private void BcMitigationButtonClick(object sender, EventArgs e) { if (sender is GridButtonXEditControl bc && bc.EditorCell.GridRow.Tag is IThreatTypeMitigation mitigation) { using (var dialog = new MitigationRuleEditDialog()) { if (dialog.Initialize(mitigation)) { dialog.Rule = mitigation.GetRule(); if (dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK) { mitigation.SetRule(dialog.Rule); } } else { ShowWarning?.Invoke( "Threat Event Generation Rule for the related Threat Type has not been set."); } } } }