private Control getNewRulePane(AddClickedEventArgs e) { RulePane triggerRulePane; String condition, value; if (e.ChildAbove != null) // er is een control boven de add button, dus zeker een rule pane { triggerRulePane = e.ChildAbove as RulePane; condition = triggerRulePane.Condition; value = triggerRulePane.Value; } else if (e.ChildUnder is RulePane) // er is geen rule pane boven de add button, maar wel een eronder { triggerRulePane = e.ChildUnder as RulePane; condition = triggerRulePane.Condition; value = triggerRulePane.Value; } else // er is geen rule pane boven of onder de add button { condition = FormulaElement.Boolean.FALSE; value = "some value"; } RulePane newRulePane = getRulePane("New rule", condition, value); newRulePane.Collapsed = false; return(newRulePane); }
private RulePane getRulePane(String name, String condition, String value) { RulePane rulePane = new RulePane(name, condition, value); rulePane.ConditionChange += (o, e) => updateFormulaInExcel(); rulePane.ValueChange += (o, e) => updateFormulaInExcel(); this.rulePanes.Add(rulePane); return(rulePane); }
public void updateRulesPane(RuleList ruleList) { int ruleNumber = 1; foreach (Rule rule in ruleList.Rules) { RulePane rulePane = getRulePane("Rule" + ruleNumber, rule.Condition, rule.Value); // TODO bepaal naam op basis van formule this.taskPaneControl.RulesStack.newChild(rulePane) .withRemoveButton() .addToBottom(); ruleNumber++; } defaultValueTextBox = new System.Windows.Controls.TextBox(); defaultValueTextBox.Text = ruleList.DefaultValue; defaultValueTextBox.TextChanged += (o, e) => updateFormulaInExcel(); defaultValuePane = VitaLib.src.TitledCollapsablePaneBuilder.create("Default value") .addIndentedChild(defaultValueTextBox) .collapsed(false) .build(); this.taskPaneControl.Stack.Children.Add(defaultValuePane); }