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; }
private void OnNewFolderAdded(object sender, TreeDirectoryEventArgs e) { var item = new TreeDirectoryListItem(e.Folder, TreeDirectoryListItemType.ShowFoldersOnly); _itemHost.AddSafe(item); item.Activated += OnItemActivated; }
private void OnObjectAdded(object sender, TEventArgs e) { var item = RepresentObject(e.Object); item.Activated += OnItemActivated; _itemHost.AddSafe(item); }