예제 #1
0
        public ToolWindowViewModel(DTE dte, OptionsViewModel options, GenerateMenuItemsHelper generateMenuHelper, Func <InternalBlameWindow> internalBlameWindowAccessor)
        {
            this.generateMenuItemsHelper = generateMenuHelper;
            this.dte = new DteWrapper(dte);
            this.internalBlameWindowAccessor = internalBlameWindowAccessor;
            Options          = options;
            ServiceContainer = new ServiceContainer(this);

            MergeCommand    = new DelegateCommand <bool?>(Merge, CanMerge);
            MergeAllCommand = new DelegateCommand(MergeAll, CanMergeAll);
            UpdateCommand   = new DelegateCommand(Update, CanUpdate);
            BlameCommand    = new DelegateCommand(Blame, CanBlame);
            CheckInCommand  = new DelegateCommand <CheckInTarget>(CheckIn, CanCheckIn);
            CompareCurrentVersionCommand  = new DelegateCommand(CompareWithCurrentVersion, CanCompareWithCurrentVersion);
            ComparePortVersionCommand     = new DelegateCommand(CompareWithPortVersion, CanCompareWithPortVersion);
            CompareCurrentWithPortCommand = new DelegateCommand(CompareCurrentWithPortVersion, CanCompareCurrentWithPortVersion);
            ManualMergeCommand            = new DelegateCommand(ManualMerge, CanManualMerge);
            NavigateToSolutionCommand     = new DelegateCommand(NavigateToSolution, CanNavigateToSolution);
            UndoCheckoutCommand           = new DelegateCommand(UndoCheckout, CanUndoCheckout);
            ShowLogCommand          = new DelegateCommand(ShowLog, CanShowLog);
            NavigateToFileCommand   = new DelegateCommand <ProjectItemBase>(NavigateToItem, CanNavigateToItem);
            ShowAllCommand          = new DelegateCommand(ShowAlllItems, CanShowAllItems);
            ShowCheckoutOnlyCommand = new DelegateCommand(ShowCheckoutOnly, CanSHowCheckoutOnly);
            ShowNewOnlyCommand      = new DelegateCommand(ShowNewOnly, CanShowNewOnly);

            FilterCriteria = CreateFilterCriteria(Options.StartupFilterType);
        }
예제 #2
0
 public void NavigateToSolution(string path, IDteWrapper dte)
 {
     Logger.AddInfo("NavigateToSolutionCommand. Start Navigate to: " + path);
     try {
         dte.OpenSolution(path);
     }
     catch (Exception e) {
         Logger.AddError("Can`t navigate to solution", e);
         MessageBox.Show("Can`t navigate to solution");
     }
     Logger.AddInfo("NavigateToSolutionCommand. End navigate");
 }
예제 #3
0
 public void NavigateToSolution(DXVcsBranch currentBranch, IDteWrapper dte)
 {
     try {
         string           filePath    = Port.ProjectFilePath;
         string           vcsFilePath = GetMergeVcsPathByOriginalPath(filePath, currentBranch);
         IDXVcsRepository repository  = DXVcsRepositoryFactory.Create(Port.VcsServer);
         string           targetPath  = repository.GetFileWorkingPath(vcsFilePath);
         dte.OpenSolution(targetPath);
     }
     catch {
         MessageBox.Show("Can`t navigate to solution");
     }
 }
예제 #4
0
 public void AddReferences(IDteWrapper dte, NavigateItem item)
 {
     try {
         BusyIndicator.Show();
         dte.ClearReferences();
         SolutionParser parser = new SolutionParser(item.Path);
         foreach (var assembly in parser.GetReferencedAssemblies(true))
         {
             dte.AddReference(assembly);
         }
     }
     finally {
         BusyIndicator.Close();
     }
 }
예제 #5
0
        public ToolWindowViewModel(DTE dte, OptionsViewModel options, GenerateMenuItemsHelper generateMenuHelper)
        {
            this.generateMenuItemsHelper = generateMenuHelper;
            this.dte         = new DteWrapper(dte);
            Options          = options;
            ServiceContainer = new ServiceContainer(this);

            MergeCommand    = new DelegateCommand <bool?>(Merge, CanMerge);
            MergeAllCommand = new DelegateCommand(MergeAll, CanMergeAll);
            UpdateCommand   = new DelegateCommand(Update, CanUpdate);
            BlameCommand    = new DelegateCommand(Blame, CanBlame);
            CheckInCommand  = new DelegateCommand <CheckInTarget>(CheckIn, CanCheckIn);
            CompareCurrentVersionCommand = new DelegateCommand(CompareWithCurrentVersion, CanCompareWithCurrentVersion);
            ComparePortVersionCommand    = new DelegateCommand(CompareWithPortVersion, CanCompareWithPortVersion);
            ManualMergeCommand           = new DelegateCommand(ManualMerge, CanManualMerge);
            NavigateToSolutionCommand    = new DelegateCommand(NavigateToSolution, CanNavigateToSolution);
            UndoCheckoutCommand          = new DelegateCommand(UndoCheckout, CanUndoCheckout);
            ShowLogCommand        = new DelegateCommand(ShowLog, CanShowLog);
            NavigateToFileCommand = new DelegateCommand <ProjectItemBase>(NavigateToItem, CanNavigateToItem);
        }
예제 #6
0
        static IEnumerable <MultiReference> ChangeVersion(IDteWrapper dte, ProjectType projectType, string newVersion)
        {
            var assemblyReferences = dte.GetReferences(x => x.Name.Contains("DevExpress")).Select(x => new MultiReference(x.Name, MultiReferenceType.Assembly).Do(mr => mr.ReplaceVersion(newVersion)));
            var projectReferences  = dte.GetProjects(x => x.Name.Contains("DevExpress")).Select(x => new MultiReference(x.FullName, MultiReferenceType.Project).Do(mr => mr.ReplaceVersion(newVersion)));

            var assemplyReferenceNames = assemblyReferences.Select(x => x.AssemblySource);
            var projectReferenceNames  = projectReferences.Select(x => x.AssemblySource);

            var model = SerializeHelper.DeSerializeNavigationConfig();

            var projects       = model.NavigateItems.Where(x => x.GeneratedProjects != null).SelectMany(x => x.GeneratedProjects).Distinct();
            var targetProjects = projects.Select(x => new MultiReference(x, MultiReferenceType.Project)).Where(project => {
                var projectRoot = ProjectRootElement.Open(project.ProjectSource);
                if (project.ProjectSource.Contains("Localization") || SolutionParser.GetProjectType(projectRoot).Conflicts(projectType))
                {
                    return(false);
                }
                var assemblyNameProperty = SolutionParser.GetAssemblyNameFromProject(projectRoot).If(DXControlsVersionHelper.HasDXVersionInfo);
                if (assemblyNameProperty == null)
                {
                    return(false);
                }
                if (projectReferenceNames.Contains(assemblyNameProperty))
                {
                    project.Type = MultiReferenceType.Project;
                    return(true);
                }
                if (assemplyReferenceNames.Contains(assemblyNameProperty))
                {
                    project.Type = MultiReferenceType.Assembly;
                    return(true);
                }
                return(false);
            }).ToList();
            var dependentProjects = targetProjects.SelectMany(x => SolutionParser.GetDXReferencePaths(x.ProjectSource, true)).Where(x => !ReferenceInfo.IsEmpty(x)).Select(x => new MultiReference(x)).ToList();

            return(Concat(targetProjects.ToList(), dependentProjects.ToList()).Distinct());
        }
예제 #7
0
 public SolitionEnumeratorHelper(IDteWrapper dte)
 {
     this.dte = dte;
     solution = dte.BuildTree();
 }
예제 #8
0
 public void AddProjectReferences(IDteWrapper dte, NavigateItem item)
 {
     AddReferencesImpl(dte, item, true);
 }
예제 #9
0
        public void AddReferencesImpl(IDteWrapper dte, NavigateItem item, bool addAsProjectReference)
        {
            dte.LockCurrentProject();
            try {
                BusyIndicator.Show();

                string         path        = item.Path;
                SolutionParser parser      = new SolutionParser(path);
                var            projectType = parser.GetProjectType();

                var newAssemblies = parser.GetReferencedAssemblies(!addAsProjectReference).Select(x => new MultiReference(x));
                var newVersion    = newAssemblies.Select(x => x.AssemblySource).FirstOrDefault(DXControlsVersionHelper.HasDXVersionInfo).With(DXControlsVersionHelper.GetDXVersionString);

                BusyIndicator.UpdateText("Search for references...");

                var cache = SerializeHelper.DeserializeAddReferenceHelperCache();
                var updatedReferenceCachedItem = cache.GetItem(path);
                IEnumerable <MultiReference> updatedReferences = null;
                if (updatedReferenceCachedItem != null)
                {
                    updatedReferences = updatedReferenceCachedItem.References.Select(x => new MultiReference(x)).ToList();
                }
                else
                {
                    updatedReferences = ChangeVersion(dte, projectType, newVersion).ToList();
                    cache.AddItem(new AddReferenceHelperItem()
                    {
                        Solution = path, References = updatedReferences.Where(x => x.ReferenceSource != null).Select(x => x.ReferenceSource).ToList()
                    });
                    SerializeHelper.SerializeAddReferenceHelperCache(cache);
                }

                BusyIndicator.UpdateText("Preparing project...");

                dte.ClearReferences();
                dte.ClearProjectReferences();

                var actualReferences = Concat(newAssemblies, updatedReferences);
                if (addAsProjectReference)
                {
                    actualReferences = Concat(actualReferences, parser.GetProjectPathes().Select(x => new MultiReference(x, MultiReferenceType.Project)));
                }
                foreach (var reference in actualReferences)
                {
                    try {
                        if (reference.Type == MultiReferenceType.Assembly)
                        {
                            var assembly = projectType == ProjectType.SL ? reference.FullAssemblySource : reference.AssemblySource;
                            BusyIndicator.UpdateText("Add reference: " + assembly);
                            dte.AddReference(assembly);
                        }
                        else
                        {
                            var project = reference.ProjectSource;
                            BusyIndicator.UpdateText("Add project: " + project);
                            dte.AddProjectReference(reference.ProjectSource);
                        }
                    } catch { }
                }
            }
            finally {
                BusyIndicator.Close();
                dte.UnlockCurrentProject();
                dte.ActivateConfiguration("DebugTest");
            }
        }
예제 #10
0
 public void AddReferences(IDteWrapper dte, NavigateItem item)
 {
     AddReferencesImpl(dte, item, false);
 }