/// <summary> /// Set the main unfiltered Files list to only be checked out files /// This can then be searched on /// </summary> private void FilterFilesOnCheckedOutAndReadWrite() { string solutionDir = Common.GetSolutionDirectory(); // Get all files that are checked out for the appropriate path based on the filter selected List <string> checkedoutFiles = tfsController.GetFilesWithPendingChanges(SearchSolution && !string.IsNullOrEmpty(solutionDir) ? solutionDir : tfsController.Workspace.Folders[0].LocalItem + Singleton.GetObject().TFSPath); // First get the read/write files FilteredFiles = new ObservableCollection <TFSItemViewModel>(Files.Where(p => p.ReadWrite)); // Now get the checked out files foreach (string file in checkedoutFiles) { TFSItemViewModel newFile = new TFSItemViewModel(file); if (!FilteredFiles.Contains(newFile)) { FilteredFiles.Add(newFile); } } // Now sort them FilteredFiles = new ObservableCollection <TFSItemViewModel>(FilteredFiles.OrderBy(p => p.Filename)); }
/// <summary> /// Updates the checked out items on the filtered list /// </summary> private void SyncCheckedoutItems() { List <string> checkedoutFiles = tfsController.GetFilesWithPendingChanges(currentPath); foreach (string file in checkedoutFiles) { TFSItemViewModel item = SearchedFiles.FirstOrDefault(x => x.Filepath.ToLower() == file.ToLower()); // If the item was found if (item != null) { item.CheckedOut = true; } } }
/// <summary> /// Items should be compared on full filename /// </summary> public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Point return false. TFSItemViewModel item = obj as TFSItemViewModel; if ((System.Object)item == null) { return(false); } return(item.Filepath == Filepath); }