public QueryExpression(QueryExpressionGroup parentGroup)
        {
            InitializeComponent();

            ParentGroup = parentGroup;
            Style       = (Style)FindResource("FadeInStyle");
        }
Example #2
0
        private void AddExpressionGroup(QueryExpressionGroup group = null, int atIndex = -1)
        {
            if (group == null)
            {
                group = new QueryExpressionGroup(Builder);
            }
            group.AddExpression();
            if (group.NestedExpressions.Count == 1)
            {
                group.AddExpression();
            }
            group.Deleting += NestedGroupOnDeleting;
            group.ConvertingToExpression += GroupOnConvertingToExpression;
            group.ExpressionChanged      += (sender, args) => ExpressionChanged?.Invoke(sender, args);

            if (atIndex >= 0)
            {
                NestedExpressions.Insert(atIndex, group);
                ExpressionStackPanel.Children.Insert(atIndex, group);
            }
            else
            {
                NestedExpressions.Add(group);
                ExpressionStackPanel.Children.Add(group);
            }
            OnNestedExpressionsChanged();
        }
Example #3
0
        /// <summary>
        /// Converts an expression to a group
        /// </summary>
        private void ExpressionOnConvertToGroupClicked(object sender, EventArgs eventArgs)
        {
            try
            {
                // Get the expression that wants to convert
                var expression = sender as QueryExpression;
                if (expression == null)
                {
                    return;
                }

                int index = NestedExpressions.IndexOf(expression);

                RemoveExpression(expression);

                expression.RemoveButton.IsEnabled = true;

                var group = new QueryExpressionGroup(Builder);
                group.AddExpression(expression);
                AddExpressionGroup(group, index);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Example #4
0
 private void InitializeRootExpressionGroup(bool withChild = true)
 {
     RootExpressionGroup = new QueryExpressionGroup(this, true);
     if (withChild)
     {
         RootExpressionGroup.AddExpression();
     }
     RootExpressionGroup.ExpressionChanged += RootExpressionGroupOnExpressionChanged;
     ExpressionStackPanel.Children.Add(RootExpressionGroup);
 }
Example #5
0
        private void RemoveExpressionGroup(QueryExpressionGroup group)
        {
            group.RemoveHandlers();

            group.NestedExpressions.Clear();
            group.ExpressionStackPanel.Children.Clear();

            NestedExpressions.Remove(group);
            ExpressionStackPanel.Children.Remove(group);

            OnNestedExpressionsChanged();
        }
Example #6
0
        private QueryExpressionGroup AddSingleExpressionGroup(QueryExpressionGroup group = null)
        {
            if (group == null)
            {
                group = new QueryExpressionGroup(Builder);
            }
            group.Deleting += NestedGroupOnDeleting;
            group.ConvertingToExpression += GroupOnConvertingToExpression;
            group.ExpressionChanged      += (sender, args) => ExpressionChanged?.Invoke(sender, args);

            NestedExpressions.Add(group);
            ExpressionStackPanel.Children.Add(group);

            OnNestedExpressionsChanged();

            return(group);
        }