private void AfterTreeUpdated(FolderTree tree) { if (CurrentTree.Equals(tree)) { UpdateTree(tree); } else { CurrentTree.FindTree(tree).CopyFrom(tree); int index = GridItems.FindIndex(i => i.Tree.Equals(tree)); if (index > -1) { var item = GridItems[index]; item.Tree = tree; GridItems[index] = item; } if (tree.Equals(Settings.settings.Tree)) { SetupTreeView(tree); } else if (FindNode(LocalFoldersTreeView.RootNodes.FirstOrDefault(n => tree.Path.StartsWith((n.Content as FolderTree).Path)), tree) is TreeViewNode node) { node.Content = tree; if (!node.HasUnrealizedChildren) { FillTreeNode(node); } } } }