void AddStagedList(GitFileStatus.Pair git_file_status, SelectionRecover backup_selection, ObservableCollection <FileStatus> to) { FileStatus status = new FileStatus(this); status.Status = git_file_status.Description; status.FilePath = git_file_status.Filename; status.Display = status.FilePath; status.IsSelected = backup_selection.WasSelected(status.FilePath); to.Add(status); }
public void RefreshPending(List <string> porcelains) { if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false) { return; } var modified_backup = new SelectionRecover(ModifiedList); var staged_backup = new SelectionRecover(StagedList); var collecting_staged = new ObservableCollection <FileStatus>(); var collecting_modified = new ObservableCollection <FileStatus>(); foreach (var porcelain in porcelains) { GitFileStatus status = GitPorcelainParser.ParseFileStatus(porcelain); if (status.Staged != null) { AddStagedList(status.Staged, staged_backup, collecting_staged); } if (status.Unmerged != null) { AddModifiedList(status.Unmerged, modified_backup, collecting_modified); } if (status.Modified != null) { AddModifiedList(status.Modified, modified_backup, collecting_modified); } } StagedList = collecting_staged; ModifiedList = collecting_modified; NotifyPropertyChanged("StagedList"); NotifyPropertyChanged("ModifiedList"); if (ModifiedList.Count == 0 && StagedList.Count == 0) { gitRepository.AddLog("Nothing changed"); } }