Skip to content

Commit

Permalink
Trial fix (#12908)
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang authored Oct 28, 2022
1 parent c176537 commit 712eb41
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
11 changes: 5 additions & 6 deletions src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ internal void GetExecutingNodes(bool showRunPreview)
scheduler.ScheduleForExecution(task);
}
}
//Show node exection is checked but the graph has not RUN
//Show node execution is checked but the graph has not RUN
else
{
var deltaComputeStateArgs = new DeltaComputeStateEventArgs(new List<Guid>(), graphExecuted);
Expand All @@ -889,13 +889,12 @@ internal void GetExecutingNodes(bool showRunPreview)

private void OnPreviewGraphCompleted(AsyncTask asyncTask)
{
var updateTask = asyncTask as PreviewGraphAsyncTask;
if (updateTask != null)
if (asyncTask is PreviewGraphAsyncTask updateTask)
{
var nodeGuids = updateTask.previewGraphData;
var deltaComputeStateArgs = new DeltaComputeStateEventArgs(nodeGuids,graphExecuted);
OnSetNodeDeltaState(deltaComputeStateArgs);
}
var deltaComputeStateArgs = new DeltaComputeStateEventArgs(nodeGuids, graphExecuted);
OnSetNodeDeltaState(deltaComputeStateArgs);
}
}


Expand Down
26 changes: 16 additions & 10 deletions src/DynamoCore/Scheduler/PreviewGraphAsyncTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PreviewGraphAsyncTask : AsyncTask
private IEnumerable<NodeModel> modifiedNodes;
private bool verboseLogging;
public List<Guid> previewGraphData;

public override TaskPriority Priority
{
get { return TaskPriority.Normal; }
Expand Down Expand Up @@ -55,13 +55,13 @@ internal List<Guid> Initialize(EngineController controller, WorkspaceModel works
try
{
engineController = controller;
TargetedWorkspace = workspace;
modifiedNodes = ComputeModifiedNodes(workspace);
previewGraphData = engineController.PreviewGraphSyncData(modifiedNodes,verboseLogging);
TargetedWorkspace = workspace;
modifiedNodes = ComputeModifiedNodes(workspace);
previewGraphData = engineController.PreviewGraphSyncData(modifiedNodes, verboseLogging);
return previewGraphData;
}
catch (Exception e)
{
catch (Exception)
{
return null;
}
}
Expand All @@ -72,25 +72,31 @@ internal List<Guid> Initialize(EngineController controller, WorkspaceModel works

protected override void HandleTaskExecutionCore()
{

}

protected override void HandleTaskCompletionCore()
{

}

#endregion

#region Public Class Properties
internal WorkspaceModel TargetedWorkspace { get; private set; }
internal WorkspaceModel TargetedWorkspace { get; private set; }
#endregion

#region Private Class Helper Methods

private static IEnumerable<NodeModel> ComputeModifiedNodes(WorkspaceModel workspace)
{
return workspace.Nodes; // TODO(Ben): Implement dirty node subsetting.
// Try to calculate dirty nodes on UI side.
// This is only for UI feature. If this list inaccurate, it will not affect how VM works.
return (workspace.Nodes as List<NodeModel>).FindAll(
delegate (NodeModel node)
{
return node.IsModified;
});
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void UpdateNodesDeltaState(List<Guid> nodeGuids, bool graphExecuted)
}
}

//if the graph is executed then set the node preview to false , provided
//if the graph is executed then set the node preview to false, provided
// there is no error on that node.
if (nodeGuids.Count == 0 && graphExecuted)
{
Expand Down

0 comments on commit 712eb41

Please sign in to comment.