Ejemplo n.º 1
0
        /// <summary>
        /// Adds a project to the solution.
        /// Sets its solution property to 'this' solution.
        /// Adds it to the project cache.
        /// </summary>
        /// <param name="Project"></param>
        public bool AddProject(Project Project)
        {
            if (Project == null)
            {
                return(false);
            }

            if (!ProjectCache.Contains(Project))
            {
                AddProject(Project.FileName);
                ProjectCache.Add(Project);
            }
            else
            {
                return(false);
            }
            Project.Solution = this;
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Called when [opened project].
        /// </summary>
        /// <param name="hierarchy">The hierarchy.</param>
        /// <param name="isNew">if set to <c>true</c> [is new].</param>
        public void OnOpenedProject(IVsHierarchy hierarchy, bool isNew)
        {
            // Visual Studio reports folders as opened projects but without a name
            var project = hierarchy.ToProject();

            if (string.IsNullOrWhiteSpace(project.FullName))
            {
                return;
            }

            var projectProxy = new ProjectProxy(project.Name, project);

            projectProxy.Hierarchy     = hierarchy;
            projectProxy.SolutionProxy = this;
            projectProxy.RelativePath  = project.GetRelativePath(Source);
            projectProxy.Renamed      += ProjectProxy_Renamed;

            _projectCache.Add(projectProxy);
            Target.OnOpenedProject(projectProxy.Name);
        }