1
0
mirror of synced 2024-12-01 10:37:25 +01:00

Fix creating new instances of files breaking tree

This commit is contained in:
KillzXGaming 2019-05-02 18:56:08 -04:00
parent 8961c8e592
commit db2f7e70bd
5 changed files with 19 additions and 9 deletions

Binary file not shown.

View File

@ -43,18 +43,28 @@ namespace Switch_Toolbox.Library.Forms
public void AddNode(TreeNode node, bool ClearAllNodes = false) public void AddNode(TreeNode node, bool ClearAllNodes = false)
{ {
// Invoke the treeview to add the nodes if (treeViewCustom1.InvokeRequired)
treeViewCustom1.Invoke((Action)delegate ()
{ {
treeViewCustom1.BeginUpdate(); // No visual updates until we say // Invoke the treeview to add the nodes
// if (ClearAllNodes) treeViewCustom1.Invoke((Action)delegate ()
// ClearNodes(); {
AddNodes(node, ClearAllNodes);
treeViewCustom1.EndUpdate(); // Allow the treeview to update visually });
}); }
else
{
AddNodes(node, ClearAllNodes);
}
// _fieldsTreeCache.Nodes.Add(node);
}
private void AddNodes(TreeNode node, bool ClearAllNodes = false)
{
treeViewCustom1.BeginUpdate(); // No visual updates until we say
if (ClearAllNodes)
ClearNodes();
treeViewCustom1.Nodes.Add(node); // Add the new nodes treeViewCustom1.Nodes.Add(node); // Add the new nodes
// _fieldsTreeCache.Nodes.Add(node); treeViewCustom1.EndUpdate(); // Allow the treeview to update visually
} }
public void ClearNodes() public void ClearNodes()