void RefreshItems()
        {
            Items = new List <ChangesTreeItem>()
            {
            };
            ChangesTreeDirectoryItem root = new ChangesTreeDirectoryItem()
            {
                Name = "All"
            };
            var commitChanges = Model.CommitChanges;

            if (commitChanges == null)
            {
                return;
            }
            var r2 = commitChanges.Modified;
            var r3 = commitChanges.Deleted;
            var r  = commitChanges.Added;
            var r4 = commitChanges.Renamed;

            r2.ToList().ForEach(change => root.InsertItem(change.Path, ChangesInfo.Modified(change.Path, Model.Commit.Commit, SelectedCommit), false));
            r3.ToList().ForEach(change => root.InsertItem(change.Path, ChangesInfo.Deleted(change.Path, Model.Commit.Commit), false));
            r.ToList().ForEach(change => root.InsertItem(change.Path, ChangesInfo.Untracked(change.Path), false));
            r4.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Renamed(change.OldPath, change.Path), false); });
            if (root.Items.Any())
            {
                Items.Add(root);
            }
            OnPropertyChanged("Items");
            OnPropertyChanged("AnyItems");
        }
Exemple #2
0
        protected ChangesTreeDirectoryItem GetRootItem()
        {
            ChangesTreeDirectoryItem root = new ChangesTreeDirectoryItem()
            {
                Name = "All"
            };

            root.Checked               += () => Commit.RaiseCanExecuteChanged();
            root.Unchecked             += () => Commit.RaiseCanExecuteChanged();
            root.SubItemCheckedChanged += () => Commit.RaiseCanExecuteChanged();
            return(root);
        }
Exemple #3
0
 bool AnyChecked(ChangesTreeDirectoryItem dir)
 {
     return(dir.IsChecked || dir.Items.Any(it =>
     {
         if (it is ChangesTreeDirectoryItem)
         {
             return AnyChecked((ChangesTreeDirectoryItem)it);
         }
         else
         {
             return AnyChecked((ChangesTreeFileItem)it);
         }
     }));
 }
Exemple #4
0
        void InsertDirectoryItem(string dirName, List <string> restPath, ChangesInfo info, bool staged)
        {
            ChangesTreeDirectoryItem d = Dirs.ToList().Find(dir => dir.Name == dirName);

            if (d == null)
            {
                Items.Add(d = new ChangesTreeDirectoryItem()
                {
                    Name = dirName
                });
            }
            d.Checked               += SubItemChecked;
            d.Unchecked             += SubItemUnchecked;
            d.SubItemCheckedChanged += NotifyChange;
            d.InsertItem(restPath, info, staged);
        }
Exemple #5
0
        override protected void RefreshItems()
        {
            Items = new List <ChangesTreeItem>()
            {
            };
            ChangesTreeDirectoryItem root    = GetRootItem();
            HashSet <string>         changed = new HashSet <string>();
            var untracked = Model.RepositoryStatus.Untracked;

            untracked.ToList().ForEach(statusEntry => root.InsertItem(statusEntry.FilePath, ChangesInfo.Untracked(statusEntry.FilePath), true));
            var added = Model.RepositoryStatus.Added;

            added.ToList().ForEach(statusEntry => root.InsertItem(statusEntry.FilePath, ChangesInfo.Untracked(statusEntry.FilePath), true));
            var modified   = Model.RepositoryChanges.Modified;
            var deleted    = Model.RepositoryChanges.Deleted;
            var renamed    = Model.RepositoryChanges.Renamed;
            var conflicted = Model.RepositoryChanges.Conflicted;

            modified.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Modified(change.Path), true); changed.Add(change.Path); });
            deleted.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Deleted(change.Path), true); changed.Add(change.Path); });
            renamed.ToList().ForEach(change => { root.InsertItem(change.Path, ChangesInfo.Renamed(change.OldPath, change.Path), true); changed.Add(change.Path); });
            conflicted.ToList().ForEach(change => { root.InsertStaticItem(change.Path, ChangesInfo.Conflict(change.Path), true); changed.Add(change.Path); });
            var removed = Model.RepositoryStatus.Removed;

            removed.Where(sc => !changed.Contains(sc.FilePath)).ToList().ForEach(sc => { root.InsertItem(sc.FilePath, ChangesInfo.Deleted(sc.FilePath), true); });
            var modified2 = Model.RepositoryStatus.Modified;

            modified2.Where(sc => !changed.Contains(sc.FilePath)).ToList().ForEach(sc => { root.InsertItem(sc.FilePath, ChangesInfo.Modified(sc.FilePath), true); });
            var renamed2 = Model.RepositoryStatus.RenamedInIndex;

            renamed2.Where(sc => !changed.Contains(sc.FilePath)).ToList().ForEach(sc => { root.InsertItem(sc.FilePath, ChangesInfo.Renamed(sc.HeadToIndexRenameDetails.OldFilePath, sc.FilePath), true); });
            if (root.Items.Any())
            {
                Items.Add(root);
            }
            NotifyRefresh();
        }