c# 异步方法

private async void DynamicWorkflowAsyncCallBack()
        {
            await System.Threading.Tasks.Task.Run(() =>
            {
                if (string.IsNullOrEmpty(nodeName) || nodeName == CurrentWorkItem.Name)
                {
                    Thread.Sleep(2000);
                }
                var actionDomain = AutofacContainer.Resolver.Resolve<IProcessActionDomain>();
                var action = actionDomain.GetByTaskId(Task.TaskId);
                if (action == null || action.ActionName == "撤回")
                    return;
                var workflowNodeConfigInfoDal = AutofacContainer.Resolver.Resolve<IWorkflowNodeConfigInfoDAL>();
                var node = workflowNodeConfigInfoDal.Find(Instance.WorkflowName, CurrentWorkItem.Name);
                if (node == null || !node.ShouldCallback || string.IsNullOrEmpty(node?.CallbackUrl))
                    return;
                var approveInfo = CallbackHelper.GetApproveInfo(Instance.RecordId);
                DynamicWorkflowCallBackRequest request = new DynamicWorkflowCallBackRequest();
                request.CallbackUrl = node.CallbackUrl;
                request.RecordId = Instance.RecordId.ToString();
                request.ApprovalResults = action.ActionName != "驳回";
                request.Approver = approveInfo.ApproveUser;
                request.NodeName = node.NodeName;
                request.NodeDisplayName = node.NodeDisplayName;
                request.NextNodeName = nodeName;
                request.NextNodeDisplayName = nodeDisplayName;
                Callback(request);
                if (node.IsGaea)
                {
                    Callback(request);
                }
                else
                {
                    CallbackForNotGaea(request);
                }
            });
        }

 

posted @ 2019-01-15 10:48  直钩钓鱼  阅读(1680)  评论(0编辑  收藏  举报