Use LayoutLock for expensive construction on large node count
This commit is contained in:
parent
1b66dde24f
commit
422953d685
1 changed files with 10 additions and 5 deletions
|
|
@ -199,14 +199,19 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
// Remove but don't close all the current nodes
|
||||
content.RemoveAllChildren();
|
||||
|
||||
// Then add them back in (after the change)
|
||||
foreach (var node in Nodes)
|
||||
using (content.LayoutLock())
|
||||
{
|
||||
node.NodeParent = this;
|
||||
node.ClearRemovedFlag();
|
||||
content.AddChild(node);
|
||||
// Then add them back in (after the change)
|
||||
foreach (var node in Nodes)
|
||||
{
|
||||
node.NodeParent = this;
|
||||
node.ClearRemovedFlag();
|
||||
content.AddChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
content.PerformLayout();
|
||||
|
||||
// If the node count is ending at 0 we removed content and need to rebuild the title bar so it will net have a + in it
|
||||
expandWidget.Expandable = GetNodeCount(false) != 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue