Esempio n. 1
0
 private void InitTree(bool oneLevel)
 {
     _itemHost.Clear();
     _itemHost.Comparison = TreeItemListItem.CompareByName;
     foreach (var folder in _root.Directories)
     {
         var item = new TreeDirectoryListItem(
             folder,
             oneLevel ?
             TreeDirectoryListItemType.ShowNothing :
             TreeDirectoryListItemType.ShowFilesAndFolders,
             OnSubItemActivated,
             OnItemContextMenuRequested);
         item.Activated            += OnItemActivated;
         item.ContextMenuRequested += OnItemContextMenuRequested;
         _itemHost.Add(item);
     }
     foreach (var commit in _root.Commits)
     {
         var item = new TreeCommitListItem(commit, false);
         item.Activated            += OnItemActivated;
         item.ContextMenuRequested += OnItemContextMenuRequested;
         _itemHost.Add(item);
     }
     foreach (var file in _root.Files)
     {
         var item = new TreeFileListItem(file, false);
         item.Activated            += OnItemActivated;
         item.ContextMenuRequested += OnItemContextMenuRequested;
         _itemHost.Add(item);
     }
     _root.DirectoryAdded += OnDirectoryAdded;
     _root.CommitAdded    += OnCommitAdded;
     _root.FileAdded      += OnFileAdded;
 }
Esempio n. 2
0
 private void InsertFiles(TreeDirectory directory, bool oneLevel)
 {
     if (!oneLevel)
     {
         foreach (var subFolder in directory.Directories)
         {
             InsertFiles(subFolder, false);
         }
     }
     foreach (var commit in directory.Commits)
     {
         var item = new TreeCommitListItem(commit, true);
         item.Activated            += OnItemActivated;
         item.ContextMenuRequested += OnItemContextMenuRequested;
         _itemHost.AddSafe(item);
     }
     foreach (var file in directory.Files)
     {
         var item = new TreeFileListItem(file, true);
         item.Activated            += OnItemActivated;
         item.ContextMenuRequested += OnItemContextMenuRequested;
         _itemHost.AddSafe(item);
     }
     _trackedDirectories.Add(directory);
     if (!oneLevel)
     {
         directory.DirectoryAdded += OnDirectoryAdded2;
     }
     directory.FileAdded   += OnFileAdded;
     directory.CommitAdded += OnCommitAdded;
     directory.Deleted     += OnDirectoryDeleted;
 }
Esempio n. 3
0
        private void OnCommitAdded(object sender, TreeCommitEventArgs e)
        {
            var item = new TreeCommitListItem(e.Object, _plain);

            item.Activated            += OnItemActivated;
            item.ContextMenuRequested += OnItemContextMenuRequested;
            _itemHost.AddSafe(item);
        }