コード例 #1
0
        protected override void Execute(NativeActivityContext context)
        {
            Boolean          waitComplete = WaitComplete.Get <Boolean>(context);
            IDbContext       dbContext    = context.GetExtension <IDbContext>();
            var              messaging    = context.GetExtension <IMessaging>();
            IApplicationHost host         = context.GetExtension <IApplicationHost>();

            context.DoTrack(dbContext, TrackBefore.Get <TrackRecord>(context));
            context.DoModelState(dbContext, StateBefore.Get <ModelStateInfo>(context));

            var pi = ProcessInfo.Get <StartProcessInfo>(context);

            String bookmark = null;
            var    process  = Process.GetProcessFromContext(context);

            if (waitComplete)
            {
                bookmark = Guid.NewGuid().ToString();
                var wfResult = context.GetExtension <WorkflowResult>();
                // TODO: WAIT COMPLETE FOR CHILDREN
                //Int64 pid = process.CreateChildren(dbContext, kind, docId, bookmark, Mark.Get<String>(context));
            }

            var sfi = new StartWorkflowInfo()
            {
                UserId     = process.Owner,
                Source     = pi.Workflow,
                DataSource = pi.DataSource,
                Schema     = pi.Schema,
                Model      = pi.ModelName,
                ModelId    = pi.ModelId,
                ActionBase = pi.ActionBase,
                Parent     = process.Id
            };

            var task = AppWorkflow.StartWorkflow(host, dbContext, messaging, sfi);

            task.Wait();
            WorkflowResult result = task.Result;

            if (waitComplete)
            {
                context.CreateBookmark(bookmark, new BookmarkCallback(this.ContinueAt));
            }
            else
            {
                Result.Set(context, String.Empty);
            }
        }
コード例 #2
0
ファイル: WorkflowEngine.cs プロジェクト: sshaddicts/A2v10
 public async Task <WorkflowResult> StartWorkflow(StartWorkflowInfo info)
 {
     return(await AppWorkflow.StartWorkflow(_host, _dbContext, _messaging, info));
 }