Example #1
0
        static bool childrenPrsn(TechPresentationModelItem parent, String str)
        {
            foreach (var item in parent.Items)
            {
                var filter = parent.Presentation.Model.Filters[item.Name];
                if (filter != null)
                {
                    for (int i = 0; i < filter.Count; ++i)
                    {
                        var childCls = filter[i];
                        if (str == childCls.Name)
                        {
                            return(true);
                        }
                    }
                }
                else if (str == item.Name)
                {
                    return(true);
                }
                if (childrenPrsn(item, str))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #2
0
        static void childrenPrsn(TechPresentationModelItem oldParentItem, TechPresentationModelItem newParentItem)
        {
            var model = oldParentItem.Presentation.Model;

            foreach (var oldItem in oldParentItem.Items)
            {
                var filter = model.Filters[oldItem.Name];
                if (filter != null)
                {
                    for (int i = 0; i < filter.Count; ++i)
                    {
                        var childCls  = filter[i];
                        var parentCls = model.Classes[newParentItem.Name];
                        if (parentCls != null && model.ClassesRelations.Contains(parentCls, childCls))
                        {
                            var newItem = newParentItem.Items.Add(childCls.Name);
                            newItem.Description = childCls.Name + ": " + childCls.Description;
                            childrenPrsn(oldItem, newItem);
                        }
                    }
                }
                else
                {
                    var childCls  = model.Classes[oldItem.Name];
                    var parentCls = model.Classes[newParentItem.Name];
                    if (parentCls != null && model.ClassesRelations.Contains(parentCls, childCls))
                    {
                        var newItem = newParentItem.Items.Add(oldItem.Name);
                        newItem.Description = oldItem.Description;
                        childrenPrsn(oldItem, newItem);
                    }
                }
            }

            return;
        }