예제 #1
0
        public static ProjectNodeData Create(Project prj)
        {
            ProjectNodeData result = new ProjectNodeData();

            result.Project  = prj;
            result.ItemType = ProjectItemType.Project;
            return(result);
        }
예제 #2
0
        public static ProjectNodeData Create(Project prj, ProjectItem item)
        {
            ProjectNodeData result = new ProjectNodeData();

            result.Project  = prj;
            result.Item     = item;
            result.ItemType = item.ItemType;
            return(result);
        }
예제 #3
0
        public int Compare(Object x, Object y)
        {
            TreeNode nx = x as TreeNode;
            TreeNode ny = y as TreeNode;

            ProjectNodeData dx = GetNodeData(nx);
            ProjectNodeData dy = GetNodeData(ny);

            if (dx == null && dy == null)
            {
                return(0);
            }
            else if (dx != null && dy == null)
            {
                return(-1);
            }
            else if (dx == null && dy != null)
            {
                return(1);
            }
            else if (dx.ItemType == ProjectItemType.Project && dy.ItemType != ProjectItemType.Project)
            {
                return(-1);
            }
            else if (dx.ItemType != ProjectItemType.Project && dy.ItemType == ProjectItemType.Project)
            {
                return(1);
            }
            else if (dx.ItemType == ProjectItemType.Project && dy.ItemType == ProjectItemType.Project)
            {
                if (dx.Project != null && dy.Project != null)
                {
                    return(dx.Project.Name.ToLowerInvariant().CompareTo(dy.Project.Name.ToLowerInvariant()));
                }
                else
                {
                    return(0);
                }
            }
            else if (dx.Item != null && dy.Item == null)
            {
                return(1);
            }
            else if (dx.Item == null && dy.Item != null)
            {
                return(0);
            }
            else if (dx.Item == null && dy.Item == null)
            {
                return(nx.Text.ToLowerInvariant().CompareTo(nx.Text.ToLowerInvariant()));
            }
            else
            {
                return(dx.Item.CompareTo(dy.Item));
            }
        }