Exemplo n.º 1
0
        public void FilterSetClass <TD, TS>()
            where TS : BaseSet <TD, TS>, new()
            where TD : BaseDat <TD>, new()
        {
            TS set = setClass as TS;

            if (set != null)
            {
                set.FilterApply(delegate(TD dat)
                {
                    bool ret = true;
                    foreach (TreeNode root in this.Nodes)
                    {
                        //if (root.Checked)
                        //    ret &= true;
                        Comparison <TD> cmp = root.Tag as Comparison <TD>;
                        if (cmp != null)
                        {
                            ret &= findNodeByComparison <TD>(dat, root);
                        }
                        else
                        {
                            object val = null;
                            if (root.Tag is DatDescriptor)
                            {
                                val = ((DatDescriptor)root.Tag).GetValue(dat);
                            }
                            else if (root.Tag is ToStringDelegate)
                            {
                                val = ((ToStringDelegate)root.Tag)(dat);
                            }
                            ret &= findNodeByDescriptor(val, root);
                        }
                    }
                    return(ret);
                });
            }
        }