예제 #1
0
        /// <summary>
        /// Create a new Workflow Instance from the Workflow of a Template.
        /// </summary>
        protected WorkflowInstance CreateWorkflowInstanceFromTemplate(Report report, Template template)
        {
            // Get the Xaml from the Workflow associated to the Template
            var workflowXaml = GetWorkflowXaml(template);

            // Create a New Workflow Activity from the Xaml
            var workflowActivity = ActivityFactory.CreateActivity(workflowXaml);

            // Create a Sequence around the Workflow Activity.
            var workflowSequence = ActivityFactory.CreateSequence(workflowActivity);

            // Create a New Workflow Instance around the activity.
            var workflowInstance = WorkflowInstanceFactory.Create(report, template.Workflow.Id, workflowSequence);

            // Return the New Workflow Instance.
            return(workflowInstance);
        }