Example #1
0
        public bool Execute(IIdentity identity)
        {
            bool result = false;

            if (identity is IThreatType threatType)
            {
                using (var dialog = new RuleEditDialog())
                {
                    dialog.Initialize(threatType);

                    result = threatType.SetRule(dialog);
                }
            }

            return(result);
        }
Example #2
0
        private void BcButtonClick(object sender, EventArgs e)
        {
            if (sender is GridButtonXEditControl bc && bc.EditorCell.GridRow.Tag is IThreatType threatType)
            {
                using (var dialog = new RuleEditDialog())
                {
                    dialog.Initialize(threatType);

                    dialog.Rule = threatType.GetRule();

                    if (dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK)
                    {
                        threatType.SetRule(dialog.Rule);
                    }
                }
            }
        }
Example #3
0
        private void BcButtonClick(object sender, EventArgs e)
        {
            if (sender is GridButtonXEditControl bc && bc.EditorCell.GridRow.Tag is Question question)
            {
                using (var dialog = new RuleEditDialog())
                {
                    dialog.Initialize(_model, bc.EditorCell.GridRow.Cells["Question"].FormattedValue);
                    dialog.Rule = question.Rule;

                    if (dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK)
                    {
                        question.Rule = dialog.Rule;
                        var row = bc.EditorCell.GridRow;
                        if (row != null)
                        {
                            row.Cells[1].Value = HasSelectionRule(question) ? "Edit Rule" : "Create Rule";
                        }
                    }
                }
            }
        }