private void AndButtonClick(object sender, EventArgs e)
        {
            if (null != FiltersTreeView.SelectedNode)
            {
                if (null != FiltersTreeView.SelectedNode.Tag)
                {
                    TreeNode node = FiltersTreeView.SelectedNode;
                    IFilterable parent = (IFilterable) node.Tag;
                    Filter filter = new Filter();

                    if (parent.Filters.IsReadOnly)
                    {
                        parent.Filters = new List<IFilterable>(parent.Filters);
                    }

                    parent.Filters.Add(filter);
                    
                    node.Nodes.Add(TreeNodeMapper.MapFilter(filter));
                }
            }
            else
            {
                if (_filters.IsReadOnly)
                {
                    _filters = new List<IFilterable>(_filters);
                }

                Filter filter = new Filter();
                _filters.Add(filter);
                FiltersTreeView.Nodes.Add(TreeNodeMapper.MapFilter(filter));
            }
        }
Beispiel #2
0
        private void OrButtonClick(object sender, EventArgs e)
        {
            if (null != FiltersTreeView.SelectedNode)
            {
                if (null == FiltersTreeView.SelectedNode.Tag)
                {
                    return;
                }

                var filter = new Filter();

                if (null != FiltersTreeView.SelectedNode.Parent)
                {
                    if (null == FiltersTreeView.SelectedNode.Parent.Tag)
                    {
                        return;
                    }

                    var node   = FiltersTreeView.SelectedNode.Parent;
                    var parent = (IFilterable)node.Tag;

                    if (parent.Filters.IsReadOnly)
                    {
                        parent.Filters = new List <IFilterable>(parent.Filters);
                    }

                    parent.Filters.Add(filter);
                    node.Nodes.Add(TreeNodeMapper.MapFilter(filter));
                }
                else
                {
                    if (_filters.IsReadOnly)
                    {
                        _filters = new List <IFilterable>(_filters);
                    }

                    _filters.Add(filter);
                    FiltersTreeView.Nodes.Add(TreeNodeMapper.MapFilter(filter));
                }
            }
            else
            {
                var filter = new Filter();
                _filters.Add(filter);
                FiltersTreeView.Nodes.Add(TreeNodeMapper.MapFilter(filter));
            }
        }