Ejemplo n.º 1
0
        public ScopeGroup GetGroup(ITECScope scope)
        {
            //if (this.Scope == scope)
            //{
            //    return this;
            //}

            //foreach (ScopeGroup group in this.ChildrenGroups)
            //{
            //    ScopeGroup childGroup = group.GetGroup(scope);
            //    if (childGroup != null)
            //    {
            //        return childGroup;
            //    }
            //}
            if (scope == null)
            {
                return(null);
            }
            if (this.scopeDictionary.ContainsKey(scope))
            {
                return(scopeDictionary[scope]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public ScopeGroup Add(ITECScope child)
        {
            ScopeGroup newGroup = new ScopeGroup(child);

            this.Add(newGroup);
            return(newGroup);
        }
Ejemplo n.º 3
0
        public FilteredConnectablesGroup Add(ITECScope child)
        {
            FilteredConnectablesGroup newGroup = new FilteredConnectablesGroup(child, this.filter);

            this.Add(newGroup);
            return(newGroup);
        }
Ejemplo n.º 4
0
        public FilteredConnectablesGroup GetGroup(ITECScope scope)
        {
            if (scope == null)
            {
                return(null);
            }
            if (this.scopeDictionary.ContainsKey(scope))
            {
                return(scopeDictionary[scope]);
            }
            else
            {
                return(null);
            }

            //if (this.Scope == scope)
            //{
            //    return this;
            //}

            //foreach (FilteredConnectablesGroup group in this.ChildrenGroups)
            //{
            //    FilteredConnectablesGroup childGroup = group.GetGroup(scope);
            //    if (childGroup != null)
            //    {
            //        return childGroup;
            //    }
            //}

            //return null;
        }
Ejemplo n.º 5
0
 public ScopeGroup(ITECScope scope) : this(scope.Name)
 {
     this.Scope = scope;
     scopeDictionary.Add(scope, this);
     this.Scope.PropertyChanged += (sender, e) =>
     {
         if (e.PropertyName == "Name")
         {
             Name = scope.Name;
         }
     };
 }
Ejemplo n.º 6
0
        public bool Remove(ITECScope child)
        {
            ScopeGroup groupToRemove = scopeDictionary.ContainsKey(child) ? scopeDictionary[child] : null;

            if (groupToRemove == null)
            {
                return(false);
            }
            else
            {
                this.Remove(groupToRemove);
                return(true);
            }
        }
Ejemplo n.º 7
0
        public FilteredConnectablesGroup(ITECScope scope, ConnectableFilter filter) : this(scope.Name, filter)
        {
            this.Scope = scope;
            scopeDictionary.Add(scope, this);
            this.Scope.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == "Name")
                {
                    Name = scope.Name;
                }
            };

            if (scope is IConnectable connectable)
            {
                this.PassesFilter = filter.PassesFilter(connectable);
            }
            else
            {
                this.PassesFilter = false;
            }
        }
Ejemplo n.º 8
0
        public List <ScopeGroup> GetPath(ITECScope scope)
        {
            List <ScopeGroup> path = new List <ScopeGroup>();

            if (this.Scope == scope)
            {
                path.Add(this);
                return(path);
            }

            foreach (ScopeGroup childGroup in this.ChildrenGroups)
            {
                List <ScopeGroup> childPath = childGroup.GetPath(scope);
                if (childPath.Count > 0)
                {
                    path.Add(this);
                    path.AddRange(childPath);
                    return(path);
                }
            }

            return(path);
        }