Skip to content

Slickflow Application Code Example

besley edited this page Apr 11, 2018 · 1 revision

Slickflow Engine can be integrated with the business system. The chapter will demonstrate how to use the library.

1. Workflow Service Register

  public interface IWfServiceRegister
  {
      WfAppRunner WfAppRunner { get; set; }
      void RegisterWfAppRunner(WfAppRunner runner);
  }

2. Binding the Interface

  public partial class ProductOrderService : ServiceBase, IProductOrderService, IWfServiceRegister
  {
      #region IWorkflowRegister members
      public WfAppRunner WfAppRunner
      {
          get;
          set;
      }
      public void RegisterWfAppRunner(WfAppRunner runner)
      {
          WfAppRunner = runner;
      }
      #endregion
  }

3. Register the workflow service

    IWfServiceRegister sr = ProductOrderService as IWfServiceRegister;
    sr.RegisterWfAppRunner(runner);

4. Call the workflow service api

    var result = new WfExecutedResult();
    var wfService = new WorkflowService();
    var nodeViewList = wfService.GetNextActivityTree(runner, conditions).ToList<NodeView>();
    foreach (var node in nodeViewList)
    {
        var performerList = wfService.GetPerformerList(node);       
        Dictionary<string, PerformerList> dict = new Dictionary<string, PerformerList>();
        dict.Add(node.ActivityGUID, performerList);
        runner.NextActivityPerformers = dict;
        result = wfService.RunProcessApp(session.Connection, runner, session.Transaction);
    }