private void InitializeCore(IDictionary <string, object> workflowArgumentValues, IList <Handle> workflowExecutionProperties) { if (this.extensions != null) { this.extensions.Initialize(); if (this.extensions.HasTrackingParticipant) { this.HasTrackingParticipant = true; this.trackingProvider = new System.Activities.Tracking.TrackingProvider(this.WorkflowDefinition); foreach (TrackingParticipant participant in this.GetExtensions <TrackingParticipant>()) { this.trackingProvider.AddParticipant(participant); } } } else { this.ValidateWorkflow(null); } this.WorkflowDefinition.HasBeenAssociatedWithAnInstance = true; if (workflowArgumentValues != null) { IDictionary <string, object> objA = workflowArgumentValues; if (object.ReferenceEquals(objA, ActivityUtilities.EmptyParameters)) { objA = null; } if ((this.WorkflowDefinition.RuntimeArguments.Count > 0) || ((objA != null) && (objA.Count > 0))) { ActivityValidationServices.ValidateRootInputs(this.WorkflowDefinition, objA); } this.executor.ScheduleRootActivity(this.WorkflowDefinition, objA, workflowExecutionProperties); } else { this.executor.OnDeserialized(this.WorkflowDefinition, this); } this.executor.Open(this.SynchronizationContext); this.controller = new WorkflowInstanceControl(this, this.executor); this.isInitialized = true; if ((this.extensions != null) && this.extensions.HasWorkflowInstanceExtensions) { WorkflowInstanceProxy instance = new WorkflowInstanceProxy(this); for (int i = 0; i < this.extensions.WorkflowInstanceExtensions.Count; i++) { this.extensions.WorkflowInstanceExtensions[i].SetInstance(instance); } } }
void InitializeCore(IDictionary <string, object> workflowArgumentValues, IList <Handle> workflowExecutionProperties) { Fx.Assert(this.WorkflowDefinition.IsRuntimeReady, "EnsureDefinitionReady should have been called"); Fx.Assert(this.executor != null, "at this point, we better have an executor"); // Do Argument validation for root activities WorkflowDefinition.HasBeenAssociatedWithAnInstance = true; if (workflowArgumentValues != null) { IDictionary <string, object> actualInputs = workflowArgumentValues; if (object.ReferenceEquals(actualInputs, ActivityUtilities.EmptyParameters)) { actualInputs = null; } if (this.WorkflowDefinition.RuntimeArguments.Count > 0 || (actualInputs != null && actualInputs.Count > 0)) { ActivityValidationServices.ValidateRootInputs(this.WorkflowDefinition, actualInputs); } this.executor.ScheduleRootActivity(this.WorkflowDefinition, actualInputs, workflowExecutionProperties); } else { this.executor.OnDeserialized(this.WorkflowDefinition, this); } this.executor.Open(this.SynchronizationContext); this.controller = new WorkflowInstanceControl(this, this.executor); this.isInitialized = true; if (this.extensions != null && this.extensions.HasWorkflowInstanceExtensions) { WorkflowInstanceProxy proxy = new WorkflowInstanceProxy(this); for (int i = 0; i < this.extensions.WorkflowInstanceExtensions.Count; i++) { IWorkflowInstanceExtension extension = this.extensions.WorkflowInstanceExtensions[i]; extension.SetInstance(proxy); } } }