public void RunExpression(int?executionInterval = null) { //dynSettings.Controller.DynamoLogger.LogWarning("Running expression", WarningLevel.Mild); //If we're already running, do nothing. if (Running) { return; } // If there is preloaded trace data, send that along to the current // LiveRunner instance. Here we make sure it is done exactly once // by resetting WorkspaceModel.PreloadedTraceData property after it // is obtained. // var traceData = DynamoViewModel.Model.HomeSpace.PreloadedTraceData; DynamoViewModel.Model.HomeSpace.PreloadedTraceData = null; // Reset. EngineController.LiveRunnerCore.SetTraceDataForNodes(traceData); EngineController.GenerateGraphSyncData(DynamoViewModel.Model.HomeSpace.Nodes); if (!EngineController.HasPendingGraphSyncData) { return; } //We are now considered running Running = true; if (!testing) { //Setup background worker DynamoViewModel.RunEnabled = false; //Let's start evaluationWorker.RunWorkerAsync(executionInterval); } else { //for testing, we do not want to run asynchronously, as it will finish the //test before the evaluation (and the run) is complete RunThread(evaluationWorker, new DoWorkEventArgs(executionInterval)); } }