/// <summary> /// Refreshes this instance. /// </summary> public void Refresh() { ISccProjectInfo projectInfo; if (_project.IsSolution) { SvnItem rootItem = SolutionSettings.ProjectRootSvnItem; SetValues( Scc.IsSolutionManaged, "Solution: " + Path.GetFileNameWithoutExtension(SolutionSettings.SolutionFilename), SafeRepositoryRoot(rootItem), SafeRepositoryPath(rootItem), GetStatus(rootItem, null, SolutionSettings.SolutionFilename), (rootItem != null) ? EmptyToDot(SvnItem.MakeRelative(rootItem.FullPath, SvnTools.GetNormalizedDirectoryName(SolutionSettings.SolutionFilename))) : "", (rootItem != null) ? rootItem.FullPath : "" ); } else if (null != (projectInfo = ProjectMap.GetProjectInfo(_project)) && null != (projectInfo.ProjectDirectory) && null != (projectInfo.SccBaseDirectory)) { SvnItem dirItem = Cache[projectInfo.SccBaseDirectory]; SetValues( Scc.IsProjectManaged(_project), projectInfo.UniqueProjectName, SafeRepositoryRoot(dirItem), SafeRepositoryPath(dirItem), GetStatus(dirItem, projectInfo, projectInfo.ProjectFile), EmptyToDot(SvnItem.MakeRelative(projectInfo.SccBaseDirectory, projectInfo.ProjectDirectory)), projectInfo.SccBaseDirectory ); } else { // Should have been filtered before; probably a buggy project that changed while the dialog was open SetValues( false, "-?-", "-?-", "-?-", "-?-", "-?-", "-?-" ); } }
private void InitializeGrid() { ThreadHelper.ThrowIfNotOnUIThread(); bindingGrid.Rows.Clear(); if (Context == null) { return; } if (string.IsNullOrEmpty(SolutionSettings.SolutionFilename)) { return; } // TODO: Optimize to one time init and then just refresh if (SvnItem.IsValidPath(SolutionSettings.SolutionFilename)) { bindingGrid.Rows.Add(new ChangeSourceControlRow(Context, SccProject.Solution)); } foreach (SccProject project in ProjectMapper.GetAllSccProjects()) { if (project.IsSolution) { continue; } ISccProjectInfo projectInfo = ProjectMapper.GetProjectInfo(project); if (projectInfo == null || string.IsNullOrEmpty(projectInfo.ProjectDirectory)) { continue; } if (!projectInfo.IsSccBindable && !Scc.IsProjectManaged(project)) { continue; } bindingGrid.Rows.Add(new ChangeSourceControlRow(Context, project)); } // /TODO RefreshGrid(); }
private string GetStatus(SvnItem dirItem, ISccProjectInfo projectInfo, string file) { if (dirItem == null || !dirItem.Exists || !dirItem.IsVersioned) { return("<not found>"); } if (projectInfo == null) { if (Scc.IsSolutionManaged) { return("Connected"); // Solution itself + Connected } else { return("Not Connected"); } } if (dirItem.IsBelowPath(SolutionSettings.ProjectRootSvnItem) && dirItem.WorkingCopy == SolutionSettings.ProjectRootSvnItem.WorkingCopy) { // In master working copy if (Scc.IsSolutionManaged && Scc.IsProjectManaged(_project)) { return("Connected"); } else { return("Valid"); // In master working copy } } else if (Scc.IsSolutionManaged && Scc.IsProjectManaged(_project)) { return("Connected"); // Required information in solution } else { return("Detached"); // Separate working copy } }