private void buttonAddReaction_Click(object sender, EventArgs e) { new AddOrEditReactionForm(LoadedAsset).ShowDialog(); actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList(); actionRules.Refresh(); SetModified(); }
private void conditionSetView_OnDataChanged() { LoadedAsset.UpdateRuleConditions(selectedActionId, conditionSetView.GetData()); actionRules.DataSource = LoadedAsset.GetAllActionRules().ToList(); actionRules.Refresh(); SetModified(); }
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(); } }
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(); } }
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); } }
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); } }