public ExpressionPanel GetNewExpressionPanel(ConditionItem item)
        {
            ExpressionPanel panel = new ExpressionPanel();

            panel.Display(item);
            panel.SetReadOnly(this.IsReadOnly);
            panel.Height = 30;
            initHandlers(panel);
            return(panel);
        }
        public void Display(Instruction instruction)
        {
            trow = false;
            if (instruction == null || instruction.subInstructions.Count == 0)
            {
                Reset();
                return;
            }

            this.Children.Clear();
            foreach (Instruction child in instruction.subInstructions)
            {
                if (this.isIfBloc)
                {
                    foreach (ConditionItem item in child.conditionItems)
                    {
                        this.Children.Add(GetNewExpressionPanel(item));
                    }
                    if (child.conditionItems.Count == 0)
                    {
                        this.Children.Add(GetNewExpressionPanel(null));
                    }
                    if (this.Children.Count > 0)
                    {
                        ExpressionPanel panel = (ExpressionPanel)this.Children[0];
                        panel.OperatorComboBox.IsEnabled    = false;
                        panel.OperatorComboBox.SelectedItem = null;
                    }
                }
                else
                {
                    UIElement panel = GetNewSubItemPanel(child);
                    if (panel == null)
                    {
                        continue;
                    }
                    this.Children.Add(panel);
                }
            }
            trow = true;
        }
 protected void initHandlers(ExpressionPanel panel)
 {
     panel.Added              += OnAdd;
     panel.Deleted            += OnDelete;
     panel.ChangeEventHandler += onChange;
 }