示例#1
0
        // creates a workflow application, binds parameters, links extensions and run it
        public WorkflowApplication CreateAndRun(RequestForProposal rfp)
        {
            // input parameters for the WF program
            IDictionary <string, object> inputs = new Dictionary <string, object>();

            inputs.Add("Rfp", rfp);

            // create and run the WF instance
            Activity            wf       = new PurchaseProcessWorkflow();
            WorkflowApplication instance = new WorkflowApplication(wf, inputs)
            {
                PersistableIdle = OnIdleAndPersistable,
                Completed       = OnWorkflowCompleted,
                Idle            = OnIdle
            };
            XmlWorkflowInstanceStore store = new XmlWorkflowInstanceStore(instance.Id);

            instance.InstanceStore = store;

            //Create the persistence Participant and add it to the workflow instance
            XmlPersistenceParticipant xmlPersistenceParticipant = new XmlPersistenceParticipant(instance.Id);

            instance.Extensions.Add(xmlPersistenceParticipant);

            // add a tracking participant
            instance.Extensions.Add(new SaveAllEventsToTestFileTrackingParticipant());

            // add instance to the host list of running instances
            this.instances.Add(instance.Id, instance);

            // continue executing this instance
            instance.Run();

            return(instance);
        }
        // creates a workflow application, binds parameters, links extensions and run it
        public WorkflowApplication CreateAndRun(RequestForProposal rfp)
        {
            // input parameters for the WF program
            IDictionary<string, object> inputs = new Dictionary<string, object>();
            inputs.Add("Rfp", rfp);

            // create and run the WF instance
            Activity wf = new PurchaseProcessWorkflow();
            WorkflowApplication instance = new WorkflowApplication(wf, inputs);
            XmlWorkflowInstanceStore store = new XmlWorkflowInstanceStore(instance.Id);
            instance.InstanceStore = store;
            instance.PersistableIdle += OnIdleAndPersistable;
            instance.Completed += OnWorkflowCompleted;
            instance.Idle += OnIdle;

            //Create the persistence Participant and add it to the workflow instance
            XmlPersistenceParticipant xmlPersistenceParticipant = new XmlPersistenceParticipant(instance.Id);
            instance.Extensions.Add(xmlPersistenceParticipant);

            // add a tracking participant
            instance.Extensions.Add(new SaveAllEventsToTestFileTrackingParticipant());

            // add instance to the host list of running instances
            this.instances.Add(instance.Id, instance);

            // continue executing this instance
            instance.Run();

            return instance;
        }
示例#3
0
        // load and resume a workflow instance. If the instance is in memory,
        // will return the version from memory. If not, will load it from the
        // persistent store
        public WorkflowApplication LoadInstance(Guid instanceId)
        {
            // if the instance is in memory, return it
            if (this.instances.ContainsKey(instanceId))
            {
                return(this.instances[instanceId]);
            }

            // load the instance
            XmlWorkflowInstanceStore instStore = new XmlWorkflowInstanceStore(instanceId);
            WorkflowApplication      instance  = new WorkflowApplication(new PurchaseProcessWorkflow())
            {
                InstanceStore = instStore,
                Completed     = OnWorkflowCompleted,
                Idle          = OnIdle
            };

            // add a tracking participant
            instance.Extensions.Add(new SaveAllEventsToTestFileTrackingParticipant());

            // add the instance to the list of running instances in the host
            instance.Load(instanceId);
            this.instances.Add(instance.Id, instance);
            return(instance);
        }
        // load and resume a workflow instance. If the instance is in memory,
        // will return the version from memory. If not, will load it from the
        // persistent store
        public WorkflowApplication LoadInstance(Guid instanceId)
        {
            // if the instance is in memory, return it
            if (this.instances.ContainsKey(instanceId))
                return this.instances[instanceId];

            // load the instance
            XmlWorkflowInstanceStore instStore = new XmlWorkflowInstanceStore(instanceId);
            WorkflowApplication instance = new WorkflowApplication(new PurchaseProcessWorkflow());
            instance.InstanceStore = instStore;
            instance.Completed += OnWorkflowCompleted;
            instance.Idle += OnIdle;

            // add a tracking participant
            instance.Extensions.Add(new SaveAllEventsToTestFileTrackingParticipant());

            // add the instance to the list of running instances in the host
            instance.Load(instanceId);
            this.instances.Add(instanceId, instance);
            return instance;
        }