示例#1
0
        private void addOrEditButton_Click(object sender, EventArgs e)
        {
            try
            {
                var newReaction = new ActionRuleDTO
                {
                    Action   = textBoxAction.Value,
                    Target   = textBoxTarget.Value,
                    Priority = textBoxPriority.Value,
                    Layer    = textBoxLayer.Value,
                };

                if (_reactionToEdit != null)
                {
                    _edmAsset.UpdateActionRule(_reactionToEdit, newReaction);
                }
                else
                {
                    _edmAsset.AddActionRule(newReaction);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Close();
        }