示例#1
0
        public void Filter(UnitType f)
        {
            List <SensorNodeBase> remove = new List <SensorNodeBase>();

            foreach (SensorNodeBase node in children)
            {
                if (node != null && node.GetType() == typeof(SensorGroup))
                {
                    SensorGroup g = node as SensorGroup;
                    if (g != null)
                    {
                        g.Filter(f);
                        if (g.children.Count == 0)
                        {
                            remove.Add(node);
                        }
                    }
                }
                else if (node != null && (int)f != (int)node.unit)
                {
                    remove.Add(node);
                }
            }

            foreach (SensorNodeBase x in remove)
            {
                children.Remove(x);
            }
        }
示例#2
0
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member 'SensorNodeBase.Filter(SensorNodeBase.UnitType)'
        public void Filter(UnitType f)
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member 'SensorNodeBase.Filter(SensorNodeBase.UnitType)'
        {
            List <SensorNodeBase> remove = new List <SensorNodeBase>();

            foreach (SensorNodeBase node in children)
            {
                if (node != null && node.GetType() == typeof(SensorGroup))
                {
                    SensorGroup g = node as SensorGroup;
                    if (g != null)
                    {
                        g.Filter(f);
                        if (g.children.Count == 0)
                        {
                            remove.Add(node);
                        }
                    }
                }
                else if (node != null && (int)f != (int)node.unit)
                {
                    remove.Add(node);
                }
            }

            foreach (SensorNodeBase x in remove)
            {
                children.Remove(x);
            }
        }