static void Main(string[] args) { InstanceStore store = CreateInstanceStore(); WorkflowApplication wfApp = SetupInstance(store); Guid instanceId = wfApp.Id; wfApp.Run(); //wait for the wf to unload itself unloadedHandle.WaitOne(5000); Thread.Sleep(1000); wfApp = SetupInstance(store); wfApp.Load(instanceId); wfApp.Run(); //wait for the wf to unload itself unloadedHandle.WaitOne(5000); Thread.Sleep(1000); wfApp = SetupInstance(store); wfApp.Load(instanceId); wfApp.Run(); //wait for the wf to unload itself unloadedHandle.WaitOne(5000); Thread.Sleep(5000); wfApp = SetupInstance(store); wfApp.Load(instanceId); wfApp.Run(); waitHandle.WaitOne(10000); }
/// <summary> /// 继续工作流(书签) /// </summary> /// <param name="activity">指定活动</param> /// <param name="guid">工作流实例Guid</param> /// <param name="bookmarkName">书签名</param> /// <param name="value">工作流变量</param> public static void Resume(Activity activity, Guid guid, string bookmarkName, object value) { WorkflowApplication wfApp = PreInit(new WorkflowApplication(activity)); wfApp.Load(guid); wfApp.ResumeBookmark(bookmarkName, value); }
private void btnContinue_Click(object sender, EventArgs e) { #region Old version // Continue the workflow and pass a bookmark name and amount of the funding application // Pass those data direct to Wait4InputDataCodeActivity.InputDataCallback method //WFApplication.ResumeBookmark(this.textBoxBookmark.Text, int.Parse(this.textBoxContinue.Text)); #endregion // Get the data info from database and continues the process // Sql workflow persistence SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore("Server=.;Initial Catalog=MAPOADb;uid=sa;pwd=a5576279;"); // Create a workflow application WorkflowApplication workflowApplication = new WorkflowApplication(new WFStateMachineActivity()); workflowApplication.InstanceStore = store; // This method must be used to serialize data workflowApplication.PersistableIdle = a => { return(PersistableIdleAction.Unload); }; workflowApplication.Idle += OnWorkflowAppIdle; workflowApplication.OnUnhandledException += OnWorkflowException; workflowApplication.Unloaded = a => { Console.WriteLine("workflow unload..."); }; workflowApplication.Aborted = a => { Console.WriteLine("workflow abort"); }; // Load the instance status from database workflowApplication.Load(Guid.Parse(this.textBoxGuid.Text)); // Continue the workflow and pass a bookmark name and amount of the funding application // Pass those data direct to Wait4InputDataCodeActivity.InputDataCallback method workflowApplication.ResumeBookmark(this.textBoxBookmark.Text, int.Parse(this.textBoxContinue.Text)); }
/// <summary> /// /// </summary> /// <param name="definitionPath"></param> /// <param name="mapPath"></param> /// <param name="connectionString"></param> /// <param name="instanceId"></param> public static void Update(String definitionPath, String mapPath, String connectionString, Guid instanceId) { // Store SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore { ConnectionString = connectionString }; // Instance to update WorkflowApplicationInstance wfInstance = WorkflowApplication.GetInstance(instanceId, instanceStore); // Load update map DynamicUpdateMap updateMap; DataContractSerializer s = new DataContractSerializer(typeof(DynamicUpdateMap)); using (FileStream fs = File.Open(mapPath, FileMode.Open)) { updateMap = s.ReadObject(fs) as DynamicUpdateMap; } // if (updateMap == null) return; // Throw WorkflowApplication wfApp = new WorkflowApplication(LoadActivityBuilder(definitionPath).Implementation); IList <ActivityBlockingUpdate> act; if (wfInstance.CanApplyUpdate(updateMap, out act)) { wfApp.Load(wfInstance, updateMap); wfApp.Unload(); } }
private void QuitGame_Click(object sender, EventArgs e) { if (WorkflowInstanceId == Guid.Empty) { MessageBox.Show("Please select a workflow."); return; } WorkflowApplicationInstance instance = WorkflowApplication.GetInstance(WorkflowInstanceId, store); // Use the persisted WorkflowIdentity to retrieve the correct workflow // definition from the dictionary. Activity wf = WorkflowVersionMap.GetWorkflowDefinition(instance.DefinitionIdentity); // Associate the WorkflowApplication with the correct definition WorkflowApplication wfApp = new WorkflowApplication(wf, instance.DefinitionIdentity); // Configure the extensions and lifecycle handlers ConfigureWorkflowApplication(wfApp); // Load the workflow. wfApp.Load(instance); // Terminate the workflow. wfApp.Terminate("User resigns."); }
static void LoadAndCompleteInstance() { string input = Console.ReadLine(); WorkflowApplication application = new WorkflowApplication(activity); application.InstanceStore = instanceStore; application.Completed = (workflowApplicationCompletedEventArgs) => { Console.WriteLine("\nWorkflowApplication has Completed in the {0} state.", workflowApplicationCompletedEventArgs.CompletionState); }; application.Unloaded = (workflowApplicationEventArgs) => { Console.WriteLine("WorkflowApplication has Unloaded\n"); instanceUnloaded.Set(); }; application.Load(id); //this resumes the bookmark setup by readline application.ResumeBookmark(readLineBookmark, input); instanceUnloaded.WaitOne(); }
/// <summary> /// 重新启动工作流,是审核过程中保存审核结果的必要流程 /// </summary> /// <param name="meeting">传入一个Meeting对象,主要是取里面的InstanceID和改变Status</param> public static void RunInstance(Model.Meeting meeting) { SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore(connectionString); IDictionary <string, object> input = new Dictionary <string, object>() { { "Request", meeting } }; WorkflowApplication application1 = new WorkflowApplication(new MeetingApply()); application1.InstanceStore = instanceStore; application1.Completed = (workflowComplete) => { }; application1.Unloaded = (workflowUnloaded) => { instanceUnloaded.Set(); }; application1.PersistableIdle = (e) => { instanceUnloaded.Set(); return(PersistableIdleAction.Unload); }; application1.Load(meeting.WFID); application1.ResumeBookmark("MeetingApply", meeting.MeetingStatus); //instanceUnloaded.WaitOne(); }
public static void RunReviewApply(Guid id, ReviewUseCarApplyForm Form) { SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore(@"server=.\SQLEXPRESS;database=aspnetdb;uid=sa;pwd=123456"); WorkflowApplication application2 = new WorkflowApplication(new UseCarApply()); application2.InstanceStore = instanceStore; application2.Completed = (workflowApplicationCompletedEventArgs) => { Console.WriteLine("\nWorkflowApplication has Completed in the {0} state.", workflowApplicationCompletedEventArgs.CompletionState); instanceUnloaded.Set(); }; application2.PersistableIdle = (e) => { instanceUnloaded.Set(); return(PersistableIdleAction.Unload); }; application2.Unloaded = (workflowApplicationEventArgs) => { Console.WriteLine("WorkflowApplication has Unloaded\n"); instanceUnloaded.Set(); }; application2.Load(id); application2.ResumeBookmark("WaitForExamine", Form); instanceUnloaded.WaitOne(); Console.ReadLine(); }
public bool LoadAndRun(Guid id) { var app2 = new WorkflowApplication(new WaitForSignalOrDelayWorkflow()) { Completed = e => { if (e.CompletionState == ActivityInstanceState.Closed) { System.Runtime.Caching.MemoryCache.Default.Add(id.ToString(), e.Outputs, DateTimeOffset.MaxValue);//Save outputs at the end of the workflow. } }, Unloaded = e => { System.Diagnostics.Debug.WriteLine("Unloaded in LoadAndRun."); }, InstanceStore = WFDefinitionStore.Instance.Store, }; try { app2.Load(id); app2.Run(); } catch (System.Runtime.DurableInstancing.InstanceNotReadyException ex) { System.Diagnostics.Trace.TraceWarning(ex.Message); return(false); } System.Runtime.Caching.MemoryCache.Default.Add(id.ToString() + "Instance", app2, DateTimeOffset.MaxValue);//Keep the reference to a running instance return(true); }
public static void RunArrangeDrawOutFrom(ArrangeDrawOutFrom form) { SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore(@"server=.\SQLEXPRESS;database=aspnetdb;uid=sa;pwd=123456"); WorkflowApplication application1 = new WorkflowApplication(new UseCarApply()); application1.InstanceStore = instanceStore; application1.Completed = (workflowApplicationCompletedEventArgs) => { Console.WriteLine("\nWorkflowApplication has Completed in the {0} state.", workflowApplicationCompletedEventArgs.CompletionState); }; application1.PersistableIdle = (e) => { instanceUnloaded.Set(); return(PersistableIdleAction.Unload); }; application1.Unloaded = (workflowApplicationEventArgs) => { Console.WriteLine("WorkflowApplication has Unloaded\n"); instanceUnloaded.Set(); }; application1.Load(form.WFID); application1.ResumeBookmark("WaitArrangeDrawOut", form); instanceUnloaded.WaitOne(); Console.ReadLine(); }
private void cmdUpdateInstance_Click(object sender, RoutedEventArgs e) { SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore(); instanceStore.ConnectionString = @"Data Source=(LocalDB)\v11.0;Initial Catalog=WFPersist;Integrated Security=True"; WorkflowApplicationInstance wfInstance = WorkflowApplication.GetInstance(new Guid(txtUpdateInstance.Text), instanceStore); DataContractSerializer s = new DataContractSerializer(typeof(DynamicUpdateMap)); using (FileStream fs = File.Open(txtUpdateMapFile.Text, FileMode.Open)) { updateMap = s.ReadObject(fs) as DynamicUpdateMap; } var wfApp = new WorkflowApplication(new MovieRentalProcess(), new WorkflowIdentity { Name = "v2MovieRentalProcess", Version = new System.Version(2, 0, 0, 0) }); IList <ActivityBlockingUpdate> act; if (wfInstance.CanApplyUpdate(updateMap, out act)) { wfApp.Load(wfInstance, updateMap); wfApp.Unload(); } }
static void Run() { AutoResetEvent applicationUnloaded = new AutoResetEvent(false); WorkflowApplication application = new WorkflowApplication(workflow); application.InstanceStore = instanceStore; SetupApplication(application, applicationUnloaded); StepCountExtension stepCountExtension = new StepCountExtension(); application.Extensions.Add(stepCountExtension); application.Run(); Guid id = application.Id; applicationUnloaded.WaitOne(); while (stepCountExtension.CurrentCount < totalSteps) { application = new WorkflowApplication(workflow); application.InstanceStore = instanceStore; SetupApplication(application, applicationUnloaded); stepCountExtension = new StepCountExtension(); application.Extensions.Add(stepCountExtension); application.Load(id); string input = Console.ReadLine(); application.ResumeBookmark(echoPromptBookmark, input); applicationUnloaded.WaitOne(); } }
// 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); }
private void btnComplete_Click(object sender, RoutedEventArgs e) { if (lstLeads.SelectedIndex >= 0) { Assignment a = lstLeads.Items[lstLeads.SelectedIndex] as Assignment; a.Remarks = txtRemarks.Text; Guid id = a.WorkflowID; // Reload the workflow instance WorkflowApplication i = new WorkflowApplication(new WorkAssignment()); SetupInstance(i); i.Load(id); // Resume the instance from the last bookmark try { i.ResumeBookmark("GetCompletion", a); } catch (Exception e2) { AddEvent(e2.Message); } } }
private void btnAssign_Click(object sender, RoutedEventArgs e) { if (lstLeads.SelectedIndex >= 0) { Lead l = (Lead)lstLeads.Items[lstLeads.SelectedIndex]; Guid id = l.WorkflowID; WorkflowApplication i = new WorkflowApplication(new EnterLead()); SetupInstance(i); i.Load(id); try { i.ResumeBookmark("GetAssignment", txtAgent.Text); } catch (Exception e2) { AddEvent(e2.Message); } } //if (lstLeads.SelectedIndex >= 0) //{ // Lead l = (Lead)lstLeads.Items[lstLeads.SelectedIndex]; // Guid id = l.WorkflowID; // LeadDataDataContext dc = new LeadDataDataContext(_connectionString); // dc.Refresh(RefreshMode.OverwriteCurrentValues, dc.Leads); // l = dc.Leads.SingleOrDefault<Lead>(x => x.WorkflowID == id); // if (l != null) // { // l.AssignedTo = txtAgent.Text; // l.Status = "Assigned"; // dc.SubmitChanges(); // // Clear the input // txtAgent.Text = ""; // } // // Update the grid // lstLeads.Items[lstLeads.SelectedIndex] = l; // lstLeads.Items.Refresh(); // WorkflowApplication i = new WorkflowApplication(new EnterLead()); // //i.InstanceStore = _instanceStore; // // i.PersistableIdle = (waiea) => PersistableIdleAction.Unload; // SetupInstance(i); // i.Load(id); // try // { // i.ResumeBookmark("GetAssignment", l); // } // catch (Exception e2) // { // AddEvent(e2.Message); // } //} }
private static void UpgradeExistingWorkflow(Guid id, DynamicUpdateMap map) { SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["db"].ConnectionString); WorkflowApplicationInstance instance = WorkflowApplication.GetInstance(id, store); WorkflowApplication app = new WorkflowApplication(GetUpdatedWorkflow()); app.Load(instance, map); app.Unload(); }
public void Resume(IDSFDataObject dataObject) { var instanceID = dataObject.WorkflowInstanceId; var bookmarkName = dataObject.CurrentBookmarkName; var existingDlid = dataObject.DataListID; _instance.Load(instanceID); _instance.ResumeBookmark(bookmarkName, existingDlid); }
//恢复书签 拿到在数据库中的实例 继续执行 public static WorkflowApplication ResumeBookMark(Activity activity, Guid instanceid, string bookMarkName, object value) { AutoResetEvent autoResetEvent = new AutoResetEvent(false); WorkflowApplication wfApp = new WorkflowApplication(activity); wfApp.Idle += a =>//当工作流停下来的时候,执行此事件响应方法。 { Console.WriteLine("工作流停下来了..."); }; //工作流停下的时候,进行的操作 wfApp.PersistableIdle = delegate(WorkflowApplicationIdleEventArgs e3) { Console.WriteLine("工作卸载进行持久化"); return(PersistableIdleAction.Unload); }; wfApp.Unloaded += a => { LogHelper.WriteLog("工作流被卸载了。。"); autoResetEvent.Set(); Console.WriteLine("工作流被卸载了"); }; wfApp.OnUnhandledException += a =>//工作流异常的时候 响应的方法 { autoResetEvent.Set(); Console.WriteLine("出现了异常"); LogHelper.WriteLog(a.UnhandledException.ToString()); //记录异常信息 return(UnhandledExceptionAction.Terminate); //直接结束工作流 }; wfApp.Aborted += a =>//终止的时候 响应的方法 { autoResetEvent.Set(); Console.WriteLine("Aborted"); }; //创建一个保存 工作流实例的sqlstore对象。 SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(StrSql); //wfApp在进行持久化的时候,保存到上面对象配置的数据库里面去。 wfApp.InstanceStore = store; //从数据库中获得当前工作流实例的状态 wfApp.Load(instanceid); //工作流继续执行 wfApp.ResumeBookmark(bookMarkName, value); return(wfApp); }
public void ResumeBookmark(Guid instanceId, String bookmark, Object input) { var ii = WorkflowApplication.GetInstance(instanceId, instanceStore); var WorkflowDefinition = this.GetExtension <IWorkflowModelCatalog>()?.GetActiveModel("Process1"); var app = new WorkflowApplication(WorkflowDefinition, ii.DefinitionIdentity); EnrichWorkflowApplication(app); app.Load(instanceId); app.ResumeBookmark(bookmark, input); }
public WorkflowRun(string guid, Delegate refreshEvent) { this.refreshEvent = refreshEvent; wfApp = new WorkflowApplication(new MyWorkflow()); wfApp.InstanceStore = new SqlWorkflowInstanceStore(SqlConfig); wfApp.Load(Guid.Parse(guid)); WorkFlowEvent(wfApp /*, syncEvent*/); wfApp.Run(); syncEvent.WaitOne(); }
static void Main(string[] args) { // Event set when the workflow completes ManualResetEvent finished = new ManualResetEvent(false); // Event set when a task is ready to process AutoResetEvent taskReady = new AutoResetEvent(false); // Name of the task to process string taskName = string.Empty; // Create the workflow app & get the unique ID WorkflowApplication app = BuildApplication(finished); Guid id = app.Id; // Then add the ITaskExtension app.Extensions.Add(new TaskExtension { Execute = (task) => { taskName = task; taskReady.Set(); } }); // Run the workflow & wait for the taskReady event to be set app.Run(); taskReady.WaitOne(); // Now process that task and get the outcome bool satisfied = ProcessTask(taskName); // Now reload the workflow app = BuildApplication(finished); try { app.Load(id); // And resume the bookmark app.ResumeBookmark(taskName, satisfied); // Wait for the workflow to complete finished.WaitOne(); Console.WriteLine("Finished processing, press [Enter] to terminate"); Console.ReadLine(); } catch (InstancePersistenceCommandException ex) { Console.WriteLine("\r\n********\r\nError when trying to load the workflow - have you setup the database?\r\n********\r\n"); Console.WriteLine(ex.InnerException.ToString()); } }
public static WorkflowApplication ResumeBookMark(Activity activity, Guid instanceId, string bookmarkName, object value) { AutoResetEvent autoResetEvent = new AutoResetEvent(false); WorkflowApplication wfApp = new WorkflowApplication(activity); wfApp.Idle += a =>//当工作流停下来的时候,执行此事件响应方法。 { Console.WriteLine("工作流停下来了..."); }; //当咱们工作流停顿下来的时候,进行什么操作。如果返回是Unload。那么就卸载当前 //工作流实例,持久化到数据库里面去。 wfApp.PersistableIdle = delegate(WorkflowApplicationIdleEventArgs e3) { Console.WriteLine("工作卸载进行持久化"); return(PersistableIdleAction.Unload); }; wfApp.Unloaded += a => { Common.LogHelper.WriteLog("工作流被卸载"); autoResetEvent.Set(); Console.WriteLine("工作流被卸载"); }; wfApp.OnUnhandledException += a => { autoResetEvent.Set(); LogHelper.WriteLog(a.ExceptionSource.ToString()); Console.WriteLine("出现了异常.."); return(UnhandledExceptionAction.Terminate);//当出现未处理的异常的时候,直接结束工作流 }; wfApp.Aborted += a => { autoResetEvent.Set(); Console.WriteLine("Aborted"); }; //创建一个保存 工作流实例的sqlstore对象。 SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(StrSql); //wfApp在进行持久化的时候,保存到上面对象配置的数据库里面去。 wfApp.InstanceStore = store; //从数据库中加载当前工作流实例的状态。 wfApp.Load(instanceId); //让工作流沿着 Demo书签位置继续往下执行。 wfApp.ResumeBookmark(bookmarkName, value); return(wfApp); }
/// <summary> /// 根据id加载工作流 /// </summary> /// <param name="id"></param> /// <param name="bookMarkValue"></param> /// <param name="xaml"></param> /// <param name="bookmarkName"></param> /// <param name="ids"></param> /// <returns></returns> public string Load(string id, object bookMarkValue, string xaml = "Activity1.xaml", string bookmarkName = "BookmarkName", params object[] ids) { WorkflowApplication workflowApplication = new WorkflowApplication(ActivityXamlServices.Load(xaml)); workflowApplication.InstanceStore = GetInstanceStore(); workflowApplication.PersistableIdle = (waiea) => PersistableIdleAction.Unload; workflowApplication.Load(new Guid(id)); workflowApplication.ResumeBookmark(bookmarkName, bookMarkValue); return("ok"); }
public SESampleProcess2WorkFlow(string instanceId) : base() { SESampleProcess2 wf = new SESampleProcess2(); app = new WorkflowApplication(wf); app.InstanceStore = TrackingSqlWorkflowInstanceStore.generateOne(); Guid g = new Guid(instanceId); app.Load(g); this.MakeAsyncSync(); }
public static WorkflowApplication ResumeBookMark(Activity activity, Guid instanceId, string bookmarkName, object value) { AutoResetEvent autoResetEvent = new AutoResetEvent(false); WorkflowApplication wfApp = new WorkflowApplication(activity); wfApp.Idle += a => { Console.WriteLine("Workflow stopped"); LogHelper.WriteLog("Workflow stopped"); }; wfApp.PersistableIdle = delegate(WorkflowApplicationIdleEventArgs e2) { Console.WriteLine("Unload the workflow and persistent the data into the database when the bookmark is create"); LogHelper.WriteLog("Unload the workflow and persistent the data"); return(PersistableIdleAction.Unload); }; wfApp.Unloaded += a => { autoResetEvent.Set(); Console.WriteLine("Workflow is unloaded"); LogHelper.WriteLog("Workflow is unloaded"); }; wfApp.OnUnhandledException += a => { autoResetEvent.Set(); Console.WriteLine("exception occurred"); LogHelper.WriteLog("exception occurred"); return(UnhandledExceptionAction.Terminate); }; wfApp.Aborted += a => { autoResetEvent.Set(); Console.WriteLine("Aborted"); LogHelper.WriteLog("Aborted"); }; // Create a instance to store the workflow into sql SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(StrSql); wfApp.InstanceStore = store; // Load the workflow from database by the instance id wfApp.Load(instanceId); // Continue the workflow wfApp.ResumeBookmark(bookmarkName, value); return(wfApp); }
private static void LoadAndCompleteInstance(Guid id) { Console.WriteLine("Press <enter> to load the persisted workflow"); Console.ReadLine(); var waitHandler = new AutoResetEvent(initialState: false); var wfApp = new WorkflowApplication(new Workflow1()); wfApp.InstanceStore = _sqlWorkflowInstanceStore; wfApp.Unloaded = (workflowApplicationEventArgs) => { waitHandler.Set(); }; wfApp.Load(id); wfApp.Run(); waitHandler.WaitOne(); }
public WorkflowInstance LoadWorkflow(Guid instanceId) { var instance = this._repository.LoadWorkflowInstance(instanceId); var activity = Helpers.LoadWorkflowActiovityFromXaml(this._workflowRepositoryPath + instance.WorkflowName, this._errorLogger); if (activity != null) { WorkflowApplication app = new WorkflowApplication(activity); app.Extensions.Add(() => { SQLTrackingPaticipant participant = new SQLTrackingPaticipant(); participant.ConnectionString = _connectionString; participant.TrackingProfile = CreateTrackingProfile(); return(participant); }); if (this._isPersistable) { //setup persistence InstanceStore store = new SqlWorkflowInstanceStore( this._connectionString); InstanceHandle handle = store.CreateInstanceHandle(); InstanceView view = store.Execute(handle, new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30)); handle.Free(); store.DefaultInstanceOwner = view.InstanceOwner; app.InstanceStore = store; app.PersistableIdle = (e) => { return(PersistableIdleAction.Persist); }; } try { app.Load(instanceId); app.Run(); instance.SetApplicationhost(app); instance.SetWorkflowInstanceHandeler(this); instance.State = InstanceState.Loaded; instance.InstanceId = instanceId; this._managedWorkflows.Add(instance); this._repository.UpdateWorkflowInstanceState(app.Id, InstanceState.Loaded, instance.Bookmarks.ConvertStringListToCommaSeparatedString()); return(instance); } catch (Exception ex) { this._errorLogger.Log(ex.Message, LoggerInfoTypes.Error); } } return(null); }
public void RunWorkflow(Guid WorkOID) { WorkflowApplication appliacation = new WorkflowApplication(new WorkflowService.OrderFlow.OrderFlow()); appliacation.InstanceStore = store; appliacation.Load(WorkOID); appliacation.ResumeBookmark("WaitForManager", WorkOID); appliacation.PersistableIdle = (e) => { return(PersistableIdleAction.Unload); }; }
public string ResumeWizard(IWizardModel model) { _workflowApplication.Load(model.Id); string bookmarkName = "final"; System.Collections.ObjectModel.ReadOnlyCollection <System.Activities.Hosting.BookmarkInfo> bookmarks = _workflowApplication.GetBookmarks(); if (bookmarks != null && bookmarks.Count > 0) { bookmarkName = bookmarks[0].BookmarkName; } return(bookmarkName); }
static void Main(string[] args) { WorkflowApplication wfApp = CreateWorkflowApplication(); var workflowInstanceId = wfApp.Id; wfApp.Run(); string bookmarkName = workflowInstanceId.ToString(); wfApp.Unload(); _unloadedEvent.WaitOne(); /* create */ wfApp = CreateWorkflowApplication(); wfApp.Load(workflowInstanceId); var result = wfApp.ResumeBookmark(bookmarkName, null); // <- this hits the BookmarkActivity while **IT SHOULD'NT** }