Dynamo.Graph.Workspaces.WorkspaceModel.computeUpstreamNodesWhenWorkspaceAdded C# (CSharp) Method

computeUpstreamNodesWhenWorkspaceAdded() private method

Computes the upstream nodes when workspace is added. when a workspace is added (assuming that all the nodes and its connectors were added successfully) compute the upstream cache for all the frozen nodes.
private computeUpstreamNodesWhenWorkspaceAdded ( WorkspacesModificationEventArgs args ) : void
args WorkspacesModificationEventArgs The instance containing the event data.
return void
        private void computeUpstreamNodesWhenWorkspaceAdded(WorkspacesModificationEventArgs args)
        {
            if (args.Id == this.Guid)
            {
                this.workspaceLoaded = true;
                this.ComputeUpstreamCacheForEntireGraph();

                // If the entire graph is frozen then set silenceModification
                // to false on the workspace. This is required
                // becuase if all the nodes are frozen, then updategraphsyncdata task
                // has nothing to process and the graph will not run. setting silenceModification here
                // ensure graph runs immediately when any of the node is set to unfreeze.
                lock (nodes)
                {
                    if (nodes != null && nodes.Any() && nodes.All(z => z.IsFrozen))
                    {
                        var firstnode = nodes.First();
                        firstnode.OnRequestSilenceModifiedEvents(false);
                    }
                }
            }
        }
WorkspaceModel