Exemplo n.º 1
0
 private void buttonAddReaction_Click(object sender, EventArgs e)
 {
     new AddOrEditReactionForm(LoadedAsset).ShowDialog();
     actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList();
     actionRules.Refresh();
     SetModified();
 }
Exemplo n.º 2
0
 private void conditionSetView_OnDataChanged()
 {
     LoadedAsset.UpdateRuleConditions(selectedActionId, conditionSetView.GetData());
     actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList();
     actionRules.Refresh();
     SetModified();
 }
Exemplo n.º 3
0
 private void buttonDuplicateReaction_Click(object sender, EventArgs e)
 {
     if (dataGridViewReactiveActions.SelectedRows.Count == 1)
     {
         var a = ((ObjectView <ActionRuleDTO>)dataGridViewReactiveActions.SelectedRows[0].DataBoundItem).Object;
         var duplicateAction = CloneHelper.Clone(a);
         LoadedAsset.AddActionRule(duplicateAction);
         actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList();
         actionRules.Refresh();
         SetModified();
     }
 }
Exemplo n.º 4
0
        private void buttonEditReaction_Click(object sender, EventArgs e)
        {
            if (dataGridViewReactiveActions.SelectedRows.Count == 1)
            {
                var selectedReaction = ((ObjectView <ActionRuleDTO>)dataGridViewReactiveActions.
                                        SelectedRows[0].DataBoundItem).Object;

                new AddOrEditReactionForm(LoadedAsset, selectedReaction).ShowDialog();
                actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList();
                actionRules.Refresh();

                SetModified();
            }
        }
Exemplo n.º 5
0
        private void buttonRemoveReaction_Click(object sender, EventArgs e)
        {
            var ids = dataGridViewReactiveActions.SelectedRows.Cast <DataGridViewRow>()
                      .Select(r => ((ObjectView <ActionRuleDTO>)r.DataBoundItem).Object.Id).ToList();

            LoadedAsset.RemoveActionRules(ids);

            var rules = LoadedAsset.GetAllActionRules().ToList();

            actionRules.DataSource = rules;
            actionRules.Refresh();
            SetModified();
            if (rules == null || rules.Count == 0)
            {
                UpdateConditions(null);
            }
        }
Exemplo n.º 6
0
        protected override void OnAssetDataLoaded(EmotionalDecisionMakingAsset asset)
        {
            conditionSetView                = new ConditionSetView();
            conditionSetEditor.View         = conditionSetView;
            conditionSetView.OnDataChanged += conditionSetView_OnDataChanged;

            actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList();

            dataGridViewReactiveActions.Columns[PropertyUtil.GetPropertyName <ActionRuleDTO>(dto => dto.Priority)].DisplayIndex = 3;

            EditorTools.HideColumns(dataGridViewReactiveActions, new[]
            {
                PropertyUtil.GetPropertyName <ActionRuleDTO>(d => d.Id),
                PropertyUtil.GetPropertyName <ActionRuleDTO>(d => d.Conditions)
            });


            if (actionRules.Any())
            {
                var ra = LoadedAsset.GetActionRule(actionRules.First().Id);
                UpdateConditions(ra);
            }
        }