public void DisplayInstructions(Instruction instruction, bool readOnly = false)
        {
            this.ConditionPanel.Children.Clear();

            this.IsReadOnly = readOnly;

            if (instruction == null)
            {
                OnAddCondition(null);
                return;
            }

            foreach (Instruction child in instruction.getIfInstruction().subInstructions)
            {
                foreach (ConditionItem item in child.conditionItems)
                {
                    this.ConditionPanel.Children.Add(GetNewExpressionPanel(item));
                }
            }
            if (this.ConditionPanel.Children.Count == 0)
            {
                OnAddCondition(null);
            }
            else
            {
                ExpressionPanel panel = (ExpressionPanel)this.ConditionPanel.Children[0];
                panel.OperatorComboBox.IsEnabled    = false;
                panel.OperatorComboBox.SelectedItem = "";
            }
        }
Exemple #2
0
        protected void DisplayCondition()
        {
            this.ConditionPanel.Children.Clear();
            this.ConditionPanel.Children.Add(ConditionLabel);

            if (this.Loop.Instruction == null && String.IsNullOrWhiteSpace(this.Loop.conditions))
            {
                OnAddCondition(null);
                return;
            }
            if (this.Loop.Instruction == null && !String.IsNullOrWhiteSpace(this.Loop.conditions))
            {
                this.Loop.Instruction = TransformationTreeService.getInstructionObject(this.Loop.conditions);
            }
            foreach (Instruction child in this.Loop.Instruction.getIfInstruction().subInstructions)
            {
                foreach (ConditionItem item in child.conditionItems)
                {
                    this.ConditionPanel.Children.Add(GetNewExpressionPanel(item));
                }
            }
            if (this.ConditionPanel.Children.Count == 1)
            {
                OnAddCondition(null);
            }
            else
            {
                ExpressionPanel panel = (ExpressionPanel)this.ConditionPanel.Children[1];
                panel.OperatorComboBox.IsEnabled    = false;
                panel.OperatorComboBox.SelectedItem = "";
            }
        }
 protected void initHandlers(ExpressionPanel panel)
 {
     panel.Added              += OnAddCondition;
     panel.Deleted            += OnDeleteCondition;
     panel.ChangeEventHandler += OnChange;
     panel.GotFocus           += OnGotFocus;
     panel.MouseDown          += OnMouseDown;
 }
Exemple #4
0
        private void OnAddCondition(object item)
        {
            ExpressionPanel panel = GetNewExpressionPanel(null);

            this.ConditionPanel.Children.Add(panel);
            if (this.ConditionPanel.Children.Count == 2)
            {
                panel.OperatorComboBox.IsEnabled    = false;
                panel.OperatorComboBox.SelectedItem = "";
            }
        }
Exemple #5
0
        public ExpressionPanel GetNewExpressionPanel(ConditionItem item)
        {
            ExpressionPanel panel = new ExpressionPanel();

            panel.Margin     = new Thickness(50, 0, 0, 10);
            panel.Background = new SolidColorBrush();
            panel.DisplayFromLoop(item);
            panel.Height = 30;
            initHandlers(panel);
            return(panel);
        }
        public ExpressionPanel GetNewExpressionPanel(ConditionItem item)
        {
            ExpressionPanel panel = new ExpressionPanel();

            panel.Margin     = new Thickness(50, 0, 0, 10);
            panel.Background = new SolidColorBrush();
            panel.IsReadOnly = this.IsReadOnly;
            panel.DisplayFromLoop(item);
            panel.Height = 30;
            panel.Arg1TextBox.IsEnabled = false;
            initHandlers(panel);
            return(panel);
        }
 private void OnDeleteCondition(object item)
 {
     if (item is UIElement)
     {
         this.ConditionPanel.Children.Remove((UIElement)item);
         if (this.ConditionPanel.Children.Count == 0)
         {
             OnAddCondition(null);
         }
         else
         {
             ExpressionPanel panel = (ExpressionPanel)this.ConditionPanel.Children[0];
             panel.OperatorComboBox.IsEnabled    = false;
             panel.OperatorComboBox.SelectedItem = "";
         }
     }
 }
        private void OnAddCondition(object item)
        {
            ExpressionPanel panel = GetNewExpressionPanel(null);

            panel.Arg1TextBox.IsEnabled = false;
            panel.Arg1TextBox.Text      = "Result";
            this.ConditionPanel.Children.Add(panel);
            if (this.ConditionPanel.Children.Count == 1)
            {
                panel.OperatorComboBox.IsEnabled    = false;
                panel.OperatorComboBox.SelectedItem = "";
            }
            if (this.IsReadOnly)
            {
                panel.SetReadOnly(this.IsReadOnly);
            }
        }
Exemple #9
0
 protected void initHandlers(ExpressionPanel panel)
 {
     panel.Added              += OnAddCondition;
     panel.Deleted            += OnDeleteCondition;
     panel.ChangeEventHandler += OnChange;
 }