Exemple #1
0
        private void HandleFilter(CustomBindingList <string> sender, ListChangedEventArgs e, FilterComparator compareAttribute)
        {
            CSMEvent tag;

            switch (e.ListChangedType)
            {
            case ListChangedType.ItemAdded:
                foreach (TreeNode node in listFilterNode)
                {
                    tag = (CSMEvent)node.Tag;
                    if (tag.Compare(compareAttribute, sender[e.NewIndex]))
                    {
                        tag.filterSet |= (int)compareAttribute;
                    }
                }

                for (int index = listNode.Count - 1; index >= 0; index--)
                {
                    tag = (CSMEvent)listNode[index].Tag;
                    if (tag.Compare(compareAttribute, sender[e.NewIndex]))
                    {
                        tag.filterSet |= (int)compareAttribute;
                        listFilterNode.Add(listNode[index]);
                        listNode.RemoveAt(index);
                    }
                }
                break;

            case ListChangedType.ItemDeleted:
                for (int index = listFilterNode.Count - 1; index >= 0; index--)
                {
                    tag = (CSMEvent)listFilterNode[index].Tag;
                    if (tag.Compare(compareAttribute, sender.RemovedItem))
                    {
                        tag.filterSet &= (int)(~compareAttribute);
                        if (tag.filterSet == 0)
                        {
                            listNode.Add(listFilterNode[index]);
                            listFilterNode.RemoveAt(index);
                        }
                    }
                }
                break;

            case ListChangedType.Reset:
                foreach (TreeNode item in listFilterNode)
                {
                    listNode.Add(item);
                }
                listFilterNode.Clear();
                break;

            default:
                break;
            }
        }
Exemple #2
0
        private void listNode_ListChanged(object sender, ListChangedEventArgs e)
        {
            CustomBindingList <TreeNode> handler = (CustomBindingList <TreeNode>)sender;

            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
                treeLog.Nodes.Add(listNode[e.NewIndex]);
            }
            else if (e.ListChangedType == ListChangedType.ItemDeleted)
            {
                treeLog.Nodes.Remove(handler.RemovedItem);
            }
            else if (e.ListChangedType == ListChangedType.Reset)
            {
                treeLog.Nodes.Clear();
            }
            UpdateStatusBar();
        }
Exemple #3
0
        private void listFilterGCID_ListChanged(object sender, ListChangedEventArgs e)
        {
            CustomBindingList <string> handler = (CustomBindingList <string>)sender;

            HandleFilter(handler, e, FilterComparator.EVENT_GCID);
        }