private static void Main() { using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { poImpl = new StartPurchaseOrder(); ExternalDataExchangeService dataService = new ExternalDataExchangeService(); workflowRuntime.AddService(dataService); dataService.AddService(poImpl); workflowRuntime.WorkflowCompleted += OnWorkflowCompleted; workflowRuntime.WorkflowTerminated += OnWorkflowTerminated; // Load the workflow type. Type type = typeof(PurchaseOrderWorkflow); WorkflowInstance instance = workflowRuntime.CreateWorkflow(type); workflowInstanceId = instance.InstanceId; // Start the workflow runtime engine workflowRuntime.StartRuntime(); instance.Start(); SendPORequestMessage(); waitHandle.WaitOne(); workflowRuntime.StopRuntime(); } }
protected void Application_Start(object sender, EventArgs e) { // create an instance of workflow runtime, loading settings from web.config WorkflowRuntime workflowRuntime = new WorkflowRuntime(WorkflowManager.WorkflowRuntimeKey); // add the external data exchange service to the runtime to allow for local services ExternalDataExchangeService exchangeService = new ExternalDataExchangeService(WorkflowManager.LocalServicesKey); ////////////// Add Oracel Persistence instead of SQLServer Persistence ConnectionStringSettings connectionStringSetting = ConfigurationManager.ConnectionStrings["Oracle - ODP.NET"]; workflowRuntime.AddService(new AdoPersistenceService( connectionStringSetting, true, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1))); ////////////// CallWorkflowService serv = new CallWorkflowService(); // This is for Sub workflow service workflowRuntime.AddService(exchangeService); workflowRuntime.AddService(serv); // start the workflow runtime workflowRuntime.StartRuntime(); // save the runtime for use by the entire application Application[WorkflowManager.WorkflowRuntimeKey] = workflowRuntime; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); //create workflow runtime and manager _workflowManager = new WorkflowRuntimeManager( new WorkflowRuntime()); //add the external data exchange service to the runtime ExternalDataExchangeService exchangeService = new ExternalDataExchangeService(); _workflowManager.WorkflowRuntime.AddService(exchangeService); //add our local service _gameService = new GuessingGameService(); exchangeService.AddService(_gameService); //subscribe to the service event that sends us messages _gameService.MessageReceived += new EventHandler <MessageReceivedEventArgs>( gameService_MessageReceived); //handle the terminated event _workflowManager.WorkflowRuntime.WorkflowTerminated += new EventHandler <WorkflowTerminatedEventArgs>( WorkflowRuntime_WorkflowTerminated); }
public static Invoker Create(Guid instanceId) { // workflow runtime core WorkflowRuntime workflowRuntime = WorkflowHosting.WorkflowRuntime; // Get a reference to the ExternalDataExchangeService from the WorkflowRuntime ExternalDataExchangeService dataExchangeService = workflowRuntime.GetService <ExternalDataExchangeService>(); // Get a reference to the LocalService InvokerLocalService invokerLocalService = (InvokerLocalService)dataExchangeService.GetService(typeof(InvokerLocalService)); // get instance of the workflow WorkflowInstance instance = workflowRuntime.GetWorkflow(instanceId); try { // workaround to detect WorkflowStatus, if the status == Created, the executor will start this instance instance.Start(); } catch (Exception ex) { // WorkflowStatus != Created (therefore we can go ahead and use it) Trace.WriteLine(ex.Message); } // plug-in the local service Invoker invoker = new Invoker(invokerLocalService, instance, true); // now we can communicate with workflow instance return(invoker); }
private void StartWorkflowRuntime() { // Create a new Workflow Runtime for this application workflowRuntime = new WorkflowRuntime(); // Create EventHandlers for the WorkflowRuntime workflowRuntime.WorkflowTerminated += new EventHandler <WorkflowTerminatedEventArgs>(WorkflowRuntime_WorkflowTerminated); workflowRuntime.WorkflowCompleted += new EventHandler <WorkflowCompletedEventArgs>(WorkflowRuntime_WorkflowCompleted); workflowRuntime.WorkflowIdled += new EventHandler <WorkflowEventArgs>(workflowRuntime_WorkflowIdled); // Start the Workflow services workflowRuntime.StartRuntime(); // Add an instance of the External Data Exchange Service ExternalDataExchangeService externalDataExchangeService = new ExternalDataExchangeService(); workflowRuntime.AddService(externalDataExchangeService); // Add a new instance of the OrderService to the externalDataExchangeService speechService = new SpeechService(); externalDataExchangeService.AddService(speechService); // Subscribe to the menu text changed event speechService.PhoneTextChangedEventHandler += new SpeechService.UpdatePhoneTextEventHandler(UpdatePhoneTextEventHandler); }
public ADVIA1650() { try { _clsORecord = new ADVIA1650OrderRecord(); _clsQRecord = new ADVIA1650QueryRecord(); _clsRRecord = new ADVIA1650ResultRecord(); PrvRequestArray = new List <string>(); var objService = new ExternalDataExchangeService(); InstanceId = Guid.NewGuid(); objWorkFlowRuntime.AddService(objService); objASTM = new ClsAstm(); objService.AddService(objASTM); objASTM.SendACKEvent += objASTM_SendACKEvent; objASTM.SendNAKEvent += objASTM_SendNAKEvent; objASTM.SendENQEvent += objASTM_SendENQEvent; objASTM.SendEOTEvent += objASTM_SendEOTEvent; objWorkFlowInstance = objWorkFlowRuntime.CreateWorkflow(typeof(ASTMWorkflow), null, InstanceId); objWorkFlowInstance.Start(); Console.WriteLine("Work flow started"); objDataEventArgs = new ExternalDataEventArgs(InstanceId); objDataEventArgs.WaitForIdle = true; //DumpStateMachine(objWorkFlowRuntime, InstanceId); } catch (Exception ex) { throw ex; } }
public AU480() { try { var objService = new ExternalDataExchangeService(); InstanceId = Guid.NewGuid(); objWorkFlowRuntime.AddService(objService); objAU480 = new OlympusAUComm(); objService.AddService(objAU480); objAU480.SendACKEvent += objAU480_SendACKEvent; objAU480.ReturnRequestEvent += objAU480_ReturnRequestEvent; objAU480.ReturnDataEvent += objAU480_ReturnDataEvent; objWorkFlowInstance = objWorkFlowRuntime.CreateWorkflow(typeof(OlympusAU), null, InstanceId); objWorkFlowInstance.Start(); Console.WriteLine(@"Work flow started"); //objDataEventArgs = new ExternalDataEventArgs(InstanceId); //objDataEventArgs.WaitForIdle = true; //DumpStateMachine(objWorkFlowRuntime, InstanceId); } catch (Exception) { throw; } }
public void start() { wfRuntime = new WorkflowRuntime(); //--通信 exExchangeService = new ExternalDataExchangeService(); exEvent = new ExternalEvent(); wfRuntime.AddService(exExchangeService); exExchangeService.AddService(exEvent); //- lsWFInfo = new List <string>(); lsWFEvent = new List <string>(); wfRuntime.AddService(lsWFInfo); //事件 this.wfRuntime.WorkflowCompleted += new EventHandler <WorkflowCompletedEventArgs>(wfRuntime_WorkflowCompleted); this.wfRuntime.Started += new EventHandler <WorkflowRuntimeEventArgs>(wfRuntime_Started); this.wfRuntime.WorkflowIdled += new EventHandler <WorkflowEventArgs>(wfRuntime_WorkflowIdled); this.wfRuntime.WorkflowTerminated += new EventHandler <WorkflowTerminatedEventArgs>(wfRuntime_WorkflowTerminated); this.wfRuntime.WorkflowAborted += new EventHandler <WorkflowEventArgs>(wfRuntime_WorkflowAborted); //-启动引擎 wfRuntime.StartRuntime(); }
static void Main() { Activity workflow = CreateWorkflow(); using (System.ServiceModel.Activities.WorkflowServiceHost host = new System.ServiceModel.Activities.WorkflowServiceHost(workflow, new Uri(Program.baseAddress))) { ExternalDataExchangeService dataExchangeService = new ExternalDataExchangeService(); TaskService taskService = new TaskService(); dataExchangeService.AddService(taskService); WorkflowRuntimeEndpoint workflowRuntimeEndpoint = new WorkflowRuntimeEndpoint(); workflowRuntimeEndpoint.AddService(dataExchangeService); host.AddServiceEndpoint(workflowRuntimeEndpoint); host.AddDefaultEndpoints(); host.Open(); IWorkflow proxy = ChannelFactory <IWorkflow> .CreateChannel(new BasicHttpBinding(), new EndpointAddress(Program.baseAddress)); proxy.Start(); Console.WriteLine("Workflow starting, press enter when workflow completes.\n"); Console.ReadLine(); } }
/// <summary> /// Add any services needed by the runtime engine /// </summary> /// <param name="instance"></param> private void AddServices(WorkflowRuntime instance) { #if CUSTOM_PERSISTENCE //use the custom file based persistence service _persistence = new FileWorkflowPersistenceService(); instance.AddService(_persistence); #else //use the standard SQL Server persistence service String connStringPersistence = String.Format( "Initial Catalog={0};Data Source={1};Integrated Security={2};", "WorkflowPersistence", @"localhost\SQLEXPRESS", "SSPI"); _persistence = new SqlWorkflowPersistenceService(connStringPersistence, true, new TimeSpan(0, 2, 0), new TimeSpan(0, 0, 5)); instance.AddService(_persistence); #endif //add the external data exchange service to the runtime ExternalDataExchangeService exchangeService = new ExternalDataExchangeService(); instance.AddService(exchangeService); //add our local service _persistenceDemoService = new PersistenceDemoService(); exchangeService.AddService(_persistenceDemoService); }
/// <summary> /// 创建工作流运行时 /// </summary> /// <param name="IsPer">是否使用持久化</param> /// <returns></returns> public static WorkflowRuntime CreateWorkFlowRuntime(bool IsPer) { try { WorkflowRuntime WfRuntime = new WorkflowRuntime(); if (IsPer) { String connStringPersistence = ConfigurationManager.ConnectionStrings["SqlPersistenceConnection"].ConnectionString;//Data Source=172.30.50.110;Initial Catalog=WorkflowPersistence;Persist Security Info=True;User ID=sa;Password=fbaz2012;MultipleActiveResultSets=True"; SqlWorkflowPersistenceService persistence = new SqlWorkflowPersistenceService(connStringPersistence, true, new TimeSpan(0, 0, 30), new TimeSpan(0, 1, 0)); WfRuntime.AddService(persistence); WfRuntime.WorkflowPersisted += new EventHandler <WorkflowEventArgs>(WfRuntime_WorkflowPersisted); WfRuntime.ServicesExceptionNotHandled += new EventHandler <ServicesExceptionNotHandledEventArgs>(WfRuntime_ServicesExceptionNotHandled); // ConnectionStringSettings defaultConnectionString = ConfigurationManager.ConnectionStrings["OracleConnection"]; // WfRuntime.AddService(new AdoPersistenceService(defaultConnectionString, true, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0))); // WfRuntime.AddService(new AdoTrackingService(defaultConnectionString)); // WfRuntime.AddService(new AdoWorkBatchService()); } FlowEvent ExternalEvent = new FlowEvent(); ExternalDataExchangeService objService = new ExternalDataExchangeService(); WfRuntime.AddService(objService); objService.AddService(ExternalEvent); TypeProvider typeProvider = new TypeProvider(null); WfRuntime.AddService(typeProvider); WfRuntime.StartRuntime(); return(WfRuntime); } catch (Exception ex) { LogHelper.WriteLog("CreateWorkFlowRuntime异常信息 :" + ex.ToString()); throw new Exception(ex.Message); } }
/// <summary> /// 从持久化库在恢复实例 /// </summary> /// <param name="WfRuntime"></param> /// <param name="INSTANCEID"></param> /// <returns></returns> public static WorkflowInstance GetWorkflowInstance(WorkflowRuntime WfRuntime, string INSTANCEID) { try { WfRuntime = new WorkflowRuntime(); if (WfRuntime.GetService(typeof(AdoPersistenceService)) == null) { ConnectionStringSettings defaultConnectionString = ConfigurationManager.ConnectionStrings["OracleConnection"]; WfRuntime.AddService(new AdoPersistenceService(defaultConnectionString, true, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0))); WfRuntime.AddService(new AdoTrackingService(defaultConnectionString)); WfRuntime.AddService(new AdoWorkBatchService()); } FlowEvent ExternalEvent = new FlowEvent(); ExternalDataExchangeService objService = new ExternalDataExchangeService(); WfRuntime.AddService(objService); objService.AddService(ExternalEvent); TypeProvider typeProvider = new TypeProvider(null); WfRuntime.AddService(typeProvider); WfRuntime.StartRuntime(); WorkflowInstance instance = null; try { instance = WfRuntime.GetWorkflow(new Guid(INSTANCEID)); } catch { instance = null; } if (instance == null) //try find instance in sql server persistence { WfRuntime = new WorkflowRuntime(); ExternalEvent = new FlowEvent(); objService = new ExternalDataExchangeService(); WfRuntime.AddService(objService); objService.AddService(ExternalEvent); typeProvider = new TypeProvider(null); WfRuntime.AddService(typeProvider); String connStringPersistence = ConfigurationManager.ConnectionStrings["SqlPersistenceConnection"].ConnectionString;//Data Source=172.30.50.110;Initial Catalog=WorkflowPersistence;Persist Security Info=True;User ID=sa;Password=fbaz2012;MultipleActiveResultSets=True"; SqlWorkflowPersistenceService persistence = new SqlWorkflowPersistenceService(connStringPersistence, true, new TimeSpan(0, 2, 0), new TimeSpan(0, 0, 5)); WfRuntime.AddService(persistence); WfRuntime.StartRuntime(); instance = WfRuntime.GetWorkflow(new Guid(INSTANCEID)); } //WfRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) //{ // instance = null; //}; return(instance); } catch (Exception ex) { LogHelper.WriteLog("GetWorkflowInstance异常信息 :" + ex.ToString()); throw new Exception(ex.Message); } }
static void Main() { using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { // Create our local service and add it to the workflow runtime's list of services ExternalDataExchangeService dataService = new ExternalDataExchangeService(); workflowRuntime.AddService(dataService); VotingServiceImpl votingService = new VotingServiceImpl(); dataService.AddService(votingService); // Start up the runtime and hook the creation and completion events workflowRuntime.StartRuntime(); workflowRuntime.WorkflowCompleted += OnWorkflowCompleted; workflowRuntime.WorkflowTerminated += OnWorkflowTerminated; workflowRuntime.WorkflowStarted += OnWorkflowStarted; // Create the workflow's parameters collection Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("Alias", "Jim"); // Create and start the workflow Type type = typeof(HostCommunication.VotingServiceWorkflow); workflowRuntime.CreateWorkflow(type, parameters).Start(); waitHandle.WaitOne(); // Cleanly stop the runtime and all services workflowRuntime.StopRuntime(); } }
public static void StartWorkflowRuntime() { // Create a new Workflow Runtime for this application runtime = new WorkflowRuntime(); // Create EventHandlers for the WorkflowRuntime //runtime.WorkflowTerminated += new EventHandler<WorkflowTerminatedEventArgs>(Runtime_WorkflowTerminated); //runtime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(Runtime_WorkflowCompleted); //runtime.WorkflowIdled += new EventHandler<WorkflowEventArgs>(Runtime_WorkflowIdled); // Add the External Data Exchange Service ExternalDataExchangeService dataExchangeService = new ExternalDataExchangeService(); runtime.AddService(dataExchangeService); // Add a new instance of the OrderService to the External Data Exchange Service ValuationEvents = new ValuationProcessEvents(); dataExchangeService.AddService(ValuationEvents); // Add Persistance service to the runtime SqlWorkflowPersistenceService sqlPersistenceService = new SqlWorkflowPersistenceService("Data Source=blrserver\\sql2005;Initial Catalog=IGRSS_EF;User ID=sa;Password=trans"); runtime.AddService(sqlPersistenceService); // Start the Workflow services runtime.StartRuntime(); }
static void Main() { string connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;"; using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { ExternalDataExchangeService dataService = new ExternalDataExchangeService(); workflowRuntime.AddService(dataService); dataService.AddService(expenseService); workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectionString)); workflowRuntime.StartRuntime(); workflowRuntime.WorkflowCompleted += OnWorkflowCompleted; workflowRuntime.WorkflowTerminated += OnWorkflowTerminated; workflowRuntime.WorkflowIdled += OnWorkflowIdled; workflowRuntime.WorkflowAborted += OnWorkflowAborted; Type type = typeof(Microsoft.Samples.Workflow.CancelWorkflow.SampleWorkflow); WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(type); workflowInstance.Start(); waitHandle.WaitOne(); workflowRuntime.StopRuntime(); } }
public Mainform() { InitializeComponent(); this.runtime = new WorkflowRuntime(); runtime.WorkflowCompleted += new EventHandler <WorkflowCompletedEventArgs>(runtime_WorkflowCompleted); // Set up runtime to unload workflow instance from memory to file using FilePersistenceService FilePersistenceService filePersistence = new FilePersistenceService(true); runtime.AddService(filePersistence); // Add document approval service ExternalDataExchangeService dataService = new ExternalDataExchangeService(); runtime.AddService(dataService); documentService = new DocumentApprovalService(this); dataService.AddService(documentService); // Search for workflows that have previously been persisted to file, and load into the listview control. // These workflows will be reloaded by the runtime when events are raised against them. LoadWorkflowData(); // Start the runtime runtime.StartRuntime(); }
public TcpIpASTMManager() { try { _prvRequestArray = new Queue <List <string> >(); _currentOrder = new List <string>(); _failSending = 0; _timeoutManager = new Timer(60000); _timeoutManager.Elapsed += _timeoutManager_Elapsed; objService = new ExternalDataExchangeService(); InstanceId = Guid.NewGuid(); objWorkFlowRuntime.AddService(objService); objASTM = new ClsAstm(); objService.AddService(objASTM); objASTM.SendACKEvent += objASTM_SendACKEvent; objASTM.SendNAKEvent += objASTM_SendNAKEvent; objASTM.SendENQEvent += objASTM_SendENQEvent; objASTM.SendEOTEvent += objASTM_SendEOTEvent; //objASTM.ACKTimeoutEvent += new EventHandler(objASTM_ACKTimeoutEvent); objWorkFlowInstance = objWorkFlowRuntime.CreateWorkflow(typeof(ASTMWorkflow), null, InstanceId); objWorkFlowInstance.Start(); Console.WriteLine(string.Format(@"Work flow started")); objDataEventArgs = new ExternalDataEventArgs(InstanceId) { WaitForIdle = true }; DumpStateMachine(objWorkFlowRuntime, InstanceId); } catch (Exception ex) { Log.Error(string.Format("Error: {0}", ex)); } }
public VersaCell() { try { _clsHRecord = new VersaCellHeaderRecord(); _clsPRecord = new VersaCellPatientRecord(); _clsORecord = new VersaCellOrderRecord(); _clsQRecord = new VersaCellQueryRecord(); _clsRRecord = new VersaCellResultRecord(); _clsTRecord = new VersaCellTerminationRecord(); PrvRequestArray = new Queue <List <string> >(); objService = new ExternalDataExchangeService(); InstanceId = Guid.NewGuid(); objWorkFlowRuntime.AddService(objService); objASTM = new clsASTM(); objService.AddService(objASTM); objASTM.SendACKEvent += objASTM_SendACKEvent; objASTM.SendNAKEvent += objASTM_SendNAKEvent; objASTM.SendENQEvent += objASTM_SendENQEvent; objASTM.SendEOTEvent += objASTM_SendEOTEvent; objWorkFlowInstance = objWorkFlowRuntime.CreateWorkflow(typeof(ASTMWorkflow), null, InstanceId); objWorkFlowInstance.Start(); Console.WriteLine(@"Work flow started"); objDataEventArgs = new ExternalDataEventArgs(InstanceId); objDataEventArgs.WaitForIdle = true; DumpStateMachine(objWorkFlowRuntime, InstanceId); } catch (Exception ex) { Log.FatalException("Fatal Error: ", ex); } }
/// <summary> /// Ensures that the instance of AppointmentWorkFlowService has been initialized /// and added to the workflow's data exchange /// </summary> /// <remarks> /// There will only be a single instance of this object in activation /// at any point in time. /// </remarks> private void SetupWorkflowEnvironment() { if (_appointmentLocalService == null) { WfWcfExtension extension = OperationContext.Current.Host.Extensions.Find <WfWcfExtension>(); _workflowRuntime = extension.WorkflowRuntime; // We will try and fetch the instance from the active WorkflowRuntime's // ExtenalDataExchangeService and if it currently does not have an // activated instance, we will create a new instance and add it. ExternalDataExchangeService dataExchangeService = _workflowRuntime.GetService <ExternalDataExchangeService>(); _appointmentLocalService = (AppointmentWorkflowService)dataExchangeService.GetService(typeof(AppointmentWorkflowService)); if (_appointmentLocalService == null) { _appointmentLocalService = new AppointmentWorkflowService(); dataExchangeService.AddService(_appointmentLocalService); } } }
static void Main() { orderService = new OrderServiceImpl(); // Start the workflow runtime engine. using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { ExternalDataExchangeService dataService = new ExternalDataExchangeService(); workflowRuntime.AddService(dataService); dataService.AddService(orderService); workflowRuntime.StartRuntime(); // Listen for the workflow events workflowRuntime.WorkflowCompleted += OnWorkflowCompleted; workflowRuntime.WorkflowTerminated += OnWorkflowTerminated; workflowRuntime.WorkflowIdled += OnWorkflowIdled; // Start the workflow and wait for it to complete Type type = typeof(PurchaseOrderWorkflow); workflowRuntime.CreateWorkflow(type).Start(); waitHandle.WaitOne(); // Stop the workflow runtime engine. workflowRuntime.StopRuntime(); } }
/// <exclude /> protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { FormsWorkflow formsWorkflow = this.GetRoot <FormsWorkflow>(); IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName); ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService <ExternalDataExchangeService>(); IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService; service.DeliverFormData( WorkflowEnvironment.WorkflowInstanceId, this.ContainerLabel, StandardUiContainerTypes.Document, markupProvider, formsWorkflow.Bindings, formsWorkflow.BindingsValidationRules ); if (string.IsNullOrEmpty(this.CustomToolbarDefinitionFileName) == false) { IFormMarkupProvider customToolbarMarkupProvider = new FormDefinitionFileMarkupProvider(this.CustomToolbarDefinitionFileName); service.DeliverCustomToolbarDefinition(WorkflowEnvironment.WorkflowInstanceId, customToolbarMarkupProvider); } return(ActivityExecutionStatus.Closed); }
/// <summary> /// 创建工作流运行时 /// </summary> /// <param name="IsPer">是否使用持久化</param> /// <returns></returns> public static WorkflowRuntime CreateWorkFlowRuntime(bool IsPer) { try { WorkflowRuntime WfRuntime = new WorkflowRuntime(); if (IsPer) { ConnectionStringSettings defaultConnectionString = ConfigurationManager.ConnectionStrings["OracleConnection"]; WfRuntime.AddService(new AdoPersistenceService(defaultConnectionString, true, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0))); WfRuntime.AddService(new AdoTrackingService(defaultConnectionString)); WfRuntime.AddService(new AdoWorkBatchService()); } FlowEvent ExternalEvent = new FlowEvent(); ExternalDataExchangeService objService = new ExternalDataExchangeService(); WfRuntime.AddService(objService); objService.AddService(ExternalEvent); ManualWorkflowSchedulerService scheduleService = new ManualWorkflowSchedulerService(); WfRuntime.AddService(scheduleService); TypeProvider typeProvider = new TypeProvider(null); WfRuntime.AddService(typeProvider); WfRuntime.StartRuntime(); return(WfRuntime); } catch (Exception ex) { LogHelper.WriteLog("CreateWorkFlowRuntime异常信息 :" + ex.ToString()); throw new Exception(ex.Message); } }
/// <summary> /// Initialises and starts a workflow runtime with services specified /// by the derived implementation. /// </summary> protected void InitialiseAndStartWorkflowRuntime() { workflowRuntime = new WorkflowRuntime(); if (SchedulerService != null) { workflowRuntime.AddService(SchedulerService); } if (PersistenceService != null) { workflowRuntime.AddService(PersistenceService); } if (TrackingService != null) { workflowRuntime.AddService(TrackingService); } if (WorkBatchService != null) { workflowRuntime.AddService(WorkBatchService); } if (ExternalServices != null && ExternalServices.Count > 0) { ExternalDataExchangeService externalDataExchangeService = new ExternalDataExchangeService(); workflowRuntime.AddService(externalDataExchangeService); foreach (Object externalService in ExternalServices) { externalDataExchangeService.AddService(externalService); } } if (CustomServices != null && CustomServices.Count > 0) { foreach (Object customService in CustomServices) { workflowRuntime.AddService(customService); } } workflowRuntime.Started += workflowRuntime_Started; workflowRuntime.Stopped += workflowRuntime_Stopped; workflowRuntime.ServicesExceptionNotHandled += workflowRuntime_ServicesExceptionNotHandled; workflowRuntime.WorkflowAborted += workflowRuntime_WorkflowAborted; workflowRuntime.WorkflowCompleted += workflowRuntime_WorkflowCompleted; workflowRuntime.WorkflowCreated += workflowRuntime_WorkflowCreated; workflowRuntime.WorkflowIdled += workflowRuntime_WorkflowIdled; workflowRuntime.WorkflowLoaded += workflowRuntime_WorkflowLoaded; workflowRuntime.WorkflowPersisted += workflowRuntime_WorkflowPersisted; workflowRuntime.WorkflowResumed += workflowRuntime_WorkflowResumed; workflowRuntime.WorkflowStarted += workflowRuntime_WorkflowStarted; workflowRuntime.WorkflowSuspended += workflowRuntime_WorkflowSuspended; workflowRuntime.WorkflowTerminated += workflowRuntime_WorkflowTerminated; workflowRuntime.WorkflowUnloaded += workflowRuntime_WorkflowUnloaded; workflowRuntime.StartRuntime(); }
/// <summary> /// Adds the cms:layout elements Form Definition to the UI toolbar. /// </summary> /// <param name="customToolbarMarkupProvider">Markup provider that can deliver a valid Form Definition markup document</param> protected void SetCustomToolbarDefinition(IFormMarkupProvider customToolbarMarkupProvider) { ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService <ExternalDataExchangeService>(); var formsWorkflowActivityService = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService; formsWorkflowActivityService.DeliverCustomToolbarDefinition(WorkflowEnvironment.WorkflowInstanceId, customToolbarMarkupProvider); }
/// <summary> /// Add any services needed by the runtime engine /// </summary> /// <param name="instance"></param> private static void AddServices(WorkflowRuntime instance) { //add the external data exchange service to the runtime ExternalDataExchangeService exchangeService = new ExternalDataExchangeService("LocalServices"); instance.AddService(exchangeService); }
public void RemoveNullService() { WorkflowRuntime workflow = new WorkflowRuntime(); ExternalDataExchangeService data_change = new ExternalDataExchangeService(); workflow.AddService(data_change); data_change.RemoveService(null); }
/// <summary> /// Adds the cms:layout elements Form Definition to the UI toolbar. /// </summary> /// <param name="customToolbarDefinition">String containing a valid Form Definition markup document</param> public void SetCustomToolbarDefinition(string customToolbarDefinition) { ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService <ExternalDataExchangeService>(); IFormsWorkflowActivityService formsWorkflowActivityService = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService; formsWorkflowActivityService.DeliverCustomToolbarDefinition(WorkflowEnvironment.WorkflowInstanceId, customToolbarDefinition); }
/// <exclude /> protected void DeliverFormData(string containerLabel, IFlowUiContainerType containerType, IFormMarkupProvider formMarkupProvider, Dictionary <string, object> bindings, Dictionary <string, List <ClientValidationRule> > bindingsValidationRules) { ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService <ExternalDataExchangeService>(); IFormsWorkflowActivityService formsWorkflowActivityService = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService; formsWorkflowActivityService.DeliverFormData(WorkflowEnvironment.WorkflowInstanceId, containerLabel, containerType, formMarkupProvider, bindings, bindingsValidationRules); }
public void NoCorrelationParameter() { SampleService1 sample = new SampleService1(); WorkflowRuntime workflow = new WorkflowRuntime(); ExternalDataExchangeService data_change = new ExternalDataExchangeService(); workflow.AddService(data_change); data_change.AddService(sample); }
public void Flush() { _workflowRuntime = null; _externalDataExchangeService = null; _manualWorkflowSchedulerService = null; _fileWorkflowPersistenceService = null; _formsWorkflowEventService = null; _resourceLocker.ResetInitialization(); }