Пример #1
0
        private FilterOperationBase BuildFilter(FilterTreeNode node)
        {
            // Если узел - операция
            OperationTreeNode operationNode = node as OperationTreeNode;
            {
                if (operationNode != null)
                {
                    FilterOperation operation = new FilterOperation(operationNode.Operation);
                    foreach (object obj in operationNode.Items)
                    {
                        FilterTreeNode childNode = obj as FilterTreeNode;
                        if (childNode != null)
                        {
                            FilterOperationBase filter = BuildFilter(childNode);
                            if (filter != null)
                            {
                                operation.Children.Add(filter);
                            }
                        }
                    }
                    return(operation);
                }
            }

            // Если узел - операнд
            OperandTreeNode operand = node as OperandTreeNode;

            if (operand != null)
            {
                return(operand.Operand);
            }

            return(null);
        }
        void item_ctrl_CustomCommandClick(object sender, CustomItemEventArgs e)
        {
            switch (e.Type)
            {
                case CustomControlTypes.Clear:
                    this.Items.Clear();
                    break;
                case CustomControlTypes.Delete:
                    FilterTreeNode node = this.Parent as FilterTreeNode;
                    if (node != null)
                    {
                        node.Items.Remove(this);
                    }
                    break;
                case CustomControlTypes.AddOperation:
                    OperationTreeNode operationNode = new OperationTreeNode(OperationTypes.And, false, m_Properties);
                    operationNode.ApplyFilter += new EventHandler(OnApplyFilter);
                    this.Items.Add(operationNode);
                    OperandTreeNode operand1_Node = new OperandTreeNode(m_Properties);
                    operand1_Node.ApplyFilter += new EventHandler(OnApplyFilter);
                    operationNode.Items.Add(operand1_Node);
                    break;
                case CustomControlTypes.AddOperand:
                    OperandTreeNode operandNode = new OperandTreeNode(m_Properties);
                    operandNode.ApplyFilter += new EventHandler(OnApplyFilter);
                    this.Items.Add(operandNode);
                    break;

            }
        }
Пример #3
0
        public void Initialize(List <LevelPropertyInfo> properties)
        {
            Tree.Items.Clear();
            OperationTreeNode operationNode = new OperationTreeNode(OperationTypes.And, true, properties);

            operationNode.ApplyFilter += new EventHandler(OnApplyFilter);
            Tree.Items.Add(operationNode);
            OperandTreeNode node = new OperandTreeNode(properties);

            node.ApplyFilter += new EventHandler(ApplyFilter);
            operationNode.Items.Add(node);
            operationNode.IsExpanded = true;
        }
 public void Initialize(List<LevelPropertyInfo> properties)
 {
     Tree.Items.Clear();
     OperationTreeNode operationNode = new OperationTreeNode(OperationTypes.And, true, properties);
     operationNode.ApplyFilter += new EventHandler(OnApplyFilter);
     Tree.Items.Add(operationNode);
     OperandTreeNode node = new OperandTreeNode(properties);
     node.ApplyFilter += new EventHandler(ApplyFilter);
     operationNode.Items.Add(node);
     operationNode.IsExpanded = true;
 }