protected bool LinkExists(IVsHierarchy sourceProject, IVsHierarchy targetProject)
        {
            Project srcProject = sourceProject.GetProject();
            Project tgtProject = targetProject.GetProject();
            IProjectItemsSynchronizer first = null;

            foreach (IProjectItemsSynchronizer x in Synchronizers)
            {
                if (x.SourceProject == srcProject && x.TargetProject == tgtProject)
                {
                    first = x;
                    break;
                }
            }
            return(first != null);
        }
        public void LinkAllProjectItems(Guid sourceProject, Guid targetProject)
        {
            IProjectItemsSynchronizer syncher =
                Synchronizers.FirstOrDefault(
                    s =>
                    s.SourceProject.GetProjectGuid(_solution) == sourceProject &&
                    s.TargetProject.GetProjectGuid(_solution) == targetProject);

            if (syncher != null)
            {
                syncher.LinkAllFiles();

                _logger.Log(string.Format(CultureInfo.CurrentCulture, Resources.ProjectsSuccessfullyLinkedAll, syncher.TargetProject.Name,
                                          syncher.SourceProject.Name));
            }
        }
        public void UnlinkProjects(Guid sourceProject, Guid targetProject)
        {
            IProjectItemsSynchronizer syncher =
                Synchronizers.FirstOrDefault(
                    s =>
                    s.SourceProject.GetProjectGuid(_solution) == sourceProject &&
                    s.TargetProject.GetProjectGuid(_solution) == targetProject);

            if (syncher != null)
            {
                syncher.TargetProject.Globals.set_VariablePersists(ProjectLinkReferenceKey, false);
                Synchronizers.Remove(syncher);

                _logger.Log(string.Format(CultureInfo.CurrentCulture, Resources.ProjectsSuccessfullyUnlinked, syncher.TargetProject.Name,
                                          syncher.SourceProject.Name));
            }
        }
 public void AddProjectSyncer(IProjectItemsSynchronizer syncher)
 {
     Synchronizers.Add(syncher);
 }
        private Project GetProjectSource(Project targetProject)
        {
            IProjectItemsSynchronizer synchronizer = Synchronizers.FirstOrDefault(x => x.TargetProject == targetProject);

            return(synchronizer?.SourceProject);
        }
 public void AddProjectSyncer(IProjectItemsSynchronizer syncher)
 {
     Synchronizers.Add(syncher);
 }