예제 #1
0
        public static ProjectSetNodeViewModel CreateFrom(ProjectSetViewModel owner, ISolutionHierarchyItem node, ProjectSetContainerNodeViewModel parent)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node", "node is null.");
            }


            if (parent == null && node.ItemType != SolutionHierarchyItemType.Solution)
            {
                throw new ArgumentNullException("parent", "parent is null.");
            }

            switch (node.ItemType)
            {
            case SolutionHierarchyItemType.Solution:
                return(new ProjectSetSolutionRootNodeViewModel(owner, (ISolutionHierarchyContainerItem)node));

            case SolutionHierarchyItemType.SolutionFolder:
                return(new ProjectSetSolutionFolderNodeViewModel(owner, (ISolutionHierarchyContainerItem)node, parent));

            case SolutionHierarchyItemType.Project:
            case SolutionHierarchyItemType.UnloadedProject:
                return(new ProjectSetProjectNodeViewModel(owner, node, parent));

            default:
                throw new NotSupportedException(String.Format("Unknown project set node type {0}", node.ItemType));
            }
        }
 protected ProjectSetContainerNodeViewModel(ProjectSetViewModel owner, ISolutionHierarchyContainerItem node, ProjectSetContainerNodeViewModel parent)
     : base(owner, node, parent)
 {
     m_children = new List <ProjectSetNodeViewModel>(node.Children.Count);
     foreach (var item in node.Children.OrderBy(c => c.ItemType == SolutionHierarchyItemType.SolutionFolder ? 0 : 1).ThenBy(c => c.Name, StringComparer.OrdinalIgnoreCase))
     {
         m_children.Add(CreateFrom(owner, item, this));
     }
 }
예제 #3
0
 public ProjectSetSolutionFolderNodeViewModel(ProjectSetViewModel owner, ISolutionHierarchyContainerItem node, ProjectSetContainerNodeViewModel parent)
     : base(owner, node, parent)
 {
 }
 public ProjectSetSolutionRootNodeViewModel(ProjectSetViewModel owner, ISolutionHierarchyContainerItem node)
     : base(owner, node, null)
 {
 }
예제 #5
0
 public ProjectSetNodeViewModel(ProjectSetViewModel owner, ISolutionHierarchyItem projectSetNode, ProjectSetContainerNodeViewModel parent)
 {
     m_owner          = owner;
     m_parent         = parent;
     m_projectSetNode = projectSetNode;
 }