protected void DisplayLoopCondition() { this.LoopConditionsPanel.Children.Clear(); if (this.Loop.loopConditionsChangeHandler == null) { this.Loop.loopConditionsChangeHandler = new PersistentListChangeHandler <Kernel.Domain.LoopCondition>(); } if (this.Loop.loopConditionsChangeHandler.Items.Count == 0) { OnAddConditionItem(null); return; } else { foreach (Kernel.Domain.LoopCondition condition in this.Loop.loopConditionsChangeHandler.Items) { if (!string.IsNullOrEmpty(condition.conditions)) { condition.instructions = TransformationTreeService.getInstructionObject(condition.conditions); } LoopConditionItemPanel panel = GetNewConditionItemPanel(condition); if (condition.position == 0) { panel.OperatorComboBox.IsEnabled = false; panel.OperatorComboBox.SelectedItem = Operator.AND.ToString(); } this.LoopConditionsPanel.Children.Add(panel); } } }
protected void initLoopConditionHandlers(LoopConditionItemPanel loopConditionItemPanel) { loopConditionItemPanel.Added += OnAddConditionItem; loopConditionItemPanel.Deleted += OnDeleteConditionItem; loopConditionItemPanel.ChangeEventHandler += OnChange; loopConditionItemPanel.Updated += OnUpdateConditionLoop; loopConditionItemPanel.Activated += OnActivate; }
public LoopConditionItemPanel GetNewConditionItemPanel(object item) { LoopConditionItemPanel panel = new LoopConditionItemPanel(); panel.Margin = new Thickness(0, 0, 0, 10); panel.Background = new SolidColorBrush(); panel.Display(item, this.IsReadOnly); //panel.Height = 250; initLoopConditionHandlers(panel); return(panel); }
private void OnActivate(object item) { if (item == null) { return; } if (item is LoopConditionItemPanel) { this.ActiveLoopConditionItemPanel = (LoopConditionItemPanel)item; } }
public void SetValue(object value) { if (TabValues.IsSelected) { if (value is Measure) { this.ranking = (Measure)value; this.RankingTextBox.Text = ranking.name; OnChange(); return; } String valueType = GetLoopType(value); if (this.TypeTextBox.Text == null || this.TypeTextBox.Text.Equals("")) { this.TypeTextBox.Text = valueType; } if (!this.TypeTextBox.Text.Equals(valueType)) { if (this.ValueField.IsEmpty()) { this.TypeTextBox.Text = valueType; } else { MessageDisplayer.DisplayWarning("Wrong selection", "The selection is not conform to loop type!"); return; } } this.ValueField.SetValue(value); } else if (TabConditions.IsSelected) { if (this.ActiveLoopConditionItemPanel == null) { this.ActiveLoopConditionItemPanel = (LoopConditionItemPanel)this.ConditionPanel.Children[0]; } this.ActiveLoopConditionItemPanel.setValue(value); } else if (TabUserTemplate.IsSelected) { this.UserTemplatePanel.setValue(value); } }
private void OnDeleteConditionItem(object item) { Kernel.Domain.LoopCondition loopcondition = null; LoopConditionItemPanel panel = null; if (item is UIElement) { if (item is LoopConditionItemPanel) { panel = (LoopConditionItemPanel)item; loopcondition = panel.LoopCondition; } this.LoopConditionsPanel.Children.Remove((UIElement)panel); if (this.LoopConditionsPanel.Children.Count == 0) { OnAddConditionItem(null); } int index = 1; foreach (object pan in this.LoopConditionsPanel.Children) { ((LoopConditionItemPanel)pan).Index = index++; } ((LoopConditionItemPanel)this.LoopConditionsPanel.Children[0]).OperatorComboBox.IsEnabled = false; } if (item is Kernel.Domain.LoopCondition) { loopcondition = ((Kernel.Domain.LoopCondition)item); } if (loopcondition == null) { return; } this.Loop.SynchronizeDeleteLoopCondition(loopcondition); }
private void OnAddConditionItem(object item) { LoopConditionItemPanel panel = GetNewConditionItemPanel(item); if (this.IsReadOnly) { panel.SetReadOnly(this.IsReadOnly); } int countContainerChildren = this.LoopConditionsPanel.Children.Count + 1; panel.Index = countContainerChildren; if (panel.LoopCondition != null && item != null) { this.Loop.SynchronizeLoopCondition(panel.LoopCondition); } this.LoopConditionsPanel.Children.Add(panel); if (countContainerChildren == 1) { panel.OperatorComboBox.IsEnabled = false; //panel.OperatorComboBox.SelectedItem = ""; } }
protected void initHandlers(LoopConditionItemPanel panel) { panel.ChangeEventHandler += OnChange; }