public RunSettingsViewModel(RunSettings settings, HomeWorkspaceViewModel workspaceViewModel, DynamoViewModel dynamoViewModel) { Model = settings; Model.PropertyChanged += Model_PropertyChanged; this.workspaceViewModel = workspaceViewModel; this.dynamoViewModel = dynamoViewModel; CancelRunCommand = new DelegateCommand(CancelRun, CanCancelRun); RunExpressionCommand = new DelegateCommand(RunExpression, CanRunExpression); RunTypeItems = new ObservableCollection<RunTypeItem>(); foreach (RunType val in Enum.GetValues(typeof(RunType))) { RunTypeItems.Add(new RunTypeItem(val)); } ToggleRunTypeEnabled(RunType.Periodic, false); }
public HomeWorkspaceModel( EngineController engine, DynamoScheduler scheduler, NodeFactory factory, IEnumerable<KeyValuePair<Guid, List<string>>> traceData, IEnumerable<NodeModel> e, IEnumerable<NoteModel> n, IEnumerable<AnnotationModel> a, IEnumerable<PresetModel> presets, ElementResolver resolver, WorkspaceInfo info, bool verboseLogging, bool isTestMode) : base(e, n,a, info, factory,presets, resolver) { EvaluationCount = 0; // This protects the user from a file that might have crashed during // its last run. As a side effect, this also causes all files set to // run auto but lacking the HasRunWithoutCrash flag to run manually. if (info.RunType == RunType.Automatic && !info.HasRunWithoutCrash) { info.RunType = RunType.Manual; } RunSettings = new RunSettings(info.RunType, info.RunPeriod); PreloadedTraceData = traceData; this.scheduler = scheduler; this.verboseLogging = verboseLogging; IsTestMode = isTestMode; EngineController = engine; // The first time the preloaded trace data is set, we cache // the data as historical. This will be used after the initial // run of this workspace, when the PreloadedTraceData has been // nulled, to check for node deletions and reconcile the trace data. // We do a deep copy of this data because the PreloadedTraceData is // later set to null before the graph update. var copiedData = new List<KeyValuePair<Guid, List<string>>>(); foreach (var kvp in PreloadedTraceData) { var strings = kvp.Value.Select(string.Copy).ToList(); copiedData.Add(new KeyValuePair<Guid, List<string>>(kvp.Key, strings)); } historicalTraceData = copiedData; }