コード例 #1
0
        public void WorkflowContinue(Mercury.Server.Application application, Int64 forWorkflowId, String assemblyUrl, String workflowClassName, Guid workflowInstanceId, Server.Workflows.UserInteractions.Response.ResponseBase userInteractionResponse)
        {
            workflowId = forWorkflowId;


            assemblyReferencePath = assemblyUrl.Substring(0, assemblyUrl.LastIndexOf('\\') + 1);

            assemblyReferenceName = assemblyUrl.Replace(assemblyReferencePath, "");


            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            if (!workflowRuntime.IsStarted)
            {
                workflowRuntime.StartRuntime();
            }

            workflowInstance = workflowRuntime.GetWorkflow(workflowInstanceId);

            workflowResponse.WorkflowInstanceId = workflowInstance.InstanceId;

            workflowService.UserInteractionResponse(application, workflowInstanceId, userInteractionResponse);

            return;
        }
コード例 #2
0
        public void WorkflowContinue(Mercury.Server.Application application, Int64 workQueueItemId, String assemblyUrl, String workflowClassName, Guid workflowInstanceId, Server.Workflows.UserInteractions.Response.ResponseBase userInteractionResponse)
        {
            workflowResponse.WorkQueueItemId = workQueueItemId;


            #region Load Workflow Assembly

            assemblyReferencePath = assemblyUrl.Substring(0, assemblyUrl.LastIndexOf('\\') + 1);

            assemblyReferenceName = assemblyUrl.Replace(assemblyReferencePath, "");


            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            System.Reflection.Assembly workflowAssembly = System.Reflection.Assembly.LoadFrom(assemblyUrl);

            Type workflowClass = workflowAssembly.GetType(workflowClassName);

            if (workflowClass == null)
            {
                throw new ApplicationException("Unable to find Class [" + workflowClassName + "] in referenced Assembly [" + assemblyUrl + "].");
            }

            #endregion


            // SET RESPONSE VALUE

            UserInteractionResponse = userInteractionResponse;


            // CREATE WORKFLOW INSTANCE

            workflowInstance = new System.Activities.WorkflowApplication((System.Activities.Activity)Activator.CreateInstance(workflowAssembly.GetType(workflowClassName)));


            // LINK EVENT HANDLERS

            workflowInstance.Completed = WorkflowCompleted;

            workflowInstance.Aborted = WorkflowAborted;

            // workflowInstance.Idle = WorkflowIdle; // DO NOTHING, REMOVED, FALL THROUGH TO PERSISTABLE IDLE TO UNLOAD

            workflowInstance.PersistableIdle = WorkflowPersistableIdle;

            workflowInstance.Unloaded = WorkflowUnloaded;

            workflowInstance.OnUnhandledException = WorkflowOnUnhandledException;


            // LINK PERSISTANCE INSTANCE STORE AND LOAD FROM STORE

            workflowInstance.InstanceStore = instanceStore;

            workflowInstance.Load(workflowInstanceId);


            // RESUME FROM BOOKMARK

            workflowInstance.ResumeBookmark(workflowInstanceId.ToString(), this);


            return;
        }