Skip to content

Commit

Permalink
GroupModel to profiledGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaylo-matov committed Nov 1, 2024
1 parent 69ab2f0 commit b134668
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions TuneUp/TuneUpWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ private void CreateGroupNodesForCollection(ObservableCollection<ProfiledNodeView
{
int executionCounter = 1;
var processedNodes = new HashSet<ProfiledNodeViewModel>();
var nodesToAdd = new HashSet<ProfiledNodeViewModel>();

var sortedNodes = collection.OrderBy(n => n.ExecutionOrderNumber).ToList();

Expand Down Expand Up @@ -612,20 +613,16 @@ private void CreateGroupNodesForCollection(ObservableCollection<ProfiledNodeView
var pGroup = new ProfiledNodeViewModel(pNode)
{
GroupExecutionOrderNumber = executionCounter++,
GroupExecutionMilliseconds = groupExecTime
GroupExecutionMilliseconds = groupExecTime,
GroupModel = CurrentWorkspace.Annotations.First(n => n.GUID.Equals(pNode.GroupGUID))
};
nodesToAdd.Add(pGroup);

groupDictionary[pGroup.NodeGUID] = pGroup;
groupModelDictionary[pNode.GroupGUID].Add(pGroup);

// Create an register a new time node
var timeNode = CreateAndRegisterGroupTimeNode(pGroup);

GetCollectionViewSource(collection).Dispatcher.Invoke(() =>
{
collection.Add(timeNode);
collection.Add(pGroup);
});
nodesToAdd.Add(CreateAndRegisterGroupTimeNode(pGroup));

// Update group-related properties for all nodes in the group
foreach (var node in nodesInGroup)
Expand All @@ -635,6 +632,14 @@ private void CreateGroupNodesForCollection(ObservableCollection<ProfiledNodeView
}
}
}

GetCollectionViewSource(collection).Dispatcher.Invoke(() =>
{
foreach (var node in nodesToAdd)
{
collection.Add(node);
}
});
}

internal void OnNodeExecutionBegin(NodeModel nm)
Expand Down

0 comments on commit b134668

Please sign in to comment.