• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WorkflowContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WorkflowContext的典型用法代码示例。如果您正苦于以下问题:C# WorkflowContext类的具体用法?C# WorkflowContext怎么用?C# WorkflowContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WorkflowContext类属于命名空间,在下文中一共展示了WorkflowContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WellLogReaderUI

        /// <summary>
        /// Initializes a new instance of the <see cref="WellLogReaderUI"/> class.
        /// </summary>
        /// <param name="workstep">the workstep instance</param>
        /// <param name="args">the arguments</param>
        /// <param name="context">the underlying context in which this UI is being used</param>
        public WellLogReaderUI(WellLogReader workstep, WellLogReader.Arguments args, WorkflowContext context)
        {
            InitializeComponent();
            //this.
            this.mainCombo.SelectedIndex = 0;
            this.comboRPM.SelectedIndex = 1;
            this.comboRPM2.SelectedIndex = 1;
            this.workstep = workstep;
            this.args = args;
            this.context = context;
            WellRoot wroot = WellRoot.Get(PetrelProject.PrimaryProject);

            LogAnalysis.LogAnalysisUI analysisUserControl = new LogAnalysis.LogAnalysisUI();
            analysisUserControl.Show();
            convertorPage.Controls.Add(analysisUserControl);

            ChatServer.ServerForm chatServerForm = new ChatServer.ServerForm();
            foreach (Control c in chatServerForm.Controls)
            {
                c.Show();
                chatServerArea.Controls.Add(c);
            }

            // Now traverse the Boreholes
            String tempstr;
            String tempstr1;
            int tempctr = 0;
            int tempctr1 = 0;
            int tempctr2 = 0;
            int tempctr3 = 0;

            SeismicRoot sroot = SeismicRoot.Get(PetrelProject.PrimaryProject);
        }
开发者ID:jaigupta,项目名称:Plugged-in-Ocean,代码行数:39,代码来源:WellLogReaderUI.cs


示例2: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
            if (UserIsApproved(activityContext)) {
                yield return T("Yes");
            }

            yield return T("No");
        }
开发者ID:RasterImage,项目名称:Orchard,代码行数:7,代码来源:UserIsApprovedActivity.cs


示例3: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
            var userName = activityContext.GetState<string>("UserName");
            var email = activityContext.GetState<string>("Email");
            var password = activityContext.GetState<string>("Password");
            var approved = activityContext.GetState<bool>("Approved");

            if (String.IsNullOrWhiteSpace(userName) || String.IsNullOrWhiteSpace(email)) {
                yield return T("InvalidUserNameOrEmail");
                yield break;
            }

            if (String.IsNullOrWhiteSpace(password)) {
                yield return T("InvalidPassword");
                yield break;
            }

            if (!_userService.VerifyUserUnicity(userName, email)) {
                yield return T("UserNameOrEmailNotUnique");
                yield break;
            }

            var user = _membershipService.CreateUser(
                new CreateUserParams(
                    userName,
                    password,
                    email,
                    isApproved: approved,
                    passwordQuestion: null,
                    passwordAnswer: null));

            workflowContext.Content = user;

            yield return T("Done");
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:34,代码来源:CreateUserActivity.cs


示例4: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
            var body = activityContext.GetState<string>("Body");
            var subject = activityContext.GetState<string>("Subject");
            var recipients = activityContext.GetState<string>("Recipients");
            var replyTo = activityContext.GetState<string>("ReplyTo");
            var bcc = activityContext.GetState<string>("Bcc");
            var cc = activityContext.GetState<string>("CC");

            var parameters = new Dictionary<string, object> {
                {"Subject", subject},
                {"Body", body},
                {"Recipients", recipients},
                {"ReplyTo", replyTo},
                {"Bcc", bcc},
                {"CC", cc}
            };

            var queued = activityContext.GetState<bool>("Queued");

            if (!queued) {
                _messageService.Send(SmtpMessageChannel.MessageType, parameters);
            }
            else {
                var priority = activityContext.GetState<int>("Priority");
                _jobsQueueService.Enqueue("IMessageService.Send", new { type = SmtpMessageChannel.MessageType, parameters = parameters }, priority);
            }

            yield return T("Done");
        }
开发者ID:Higea,项目名称:Orchard,代码行数:29,代码来源:EmailActivity.cs


示例5: RetrieveTracks

 public IEnumerable<Track> RetrieveTracks(int id)
 {
     using (var context = new WorkflowContext())
     {
         return context.Tracks.Where(c => c.WorkflowRunId == id).OrderBy(c => c.EventTime).ToList();
     }
 }
开发者ID:riezebosch,项目名称:wf-deploy,代码行数:7,代码来源:TrackManager.cs


示例6: Recieveruns

 public IEnumerable<WorkflowRun> Recieveruns(int id)
 {
     using (var context = new WorkflowContext())
     {
         return context.WorkflowRuns.Where(c => c.WorkflowId == id).ToList();
     }
 }
开发者ID:riezebosch,项目名称:wf-deploy,代码行数:7,代码来源:WorkflowManager.cs


示例7: RecieveWorkflows

 public IEnumerable<Workflow> RecieveWorkflows()
 {
     using(var context = new WorkflowContext())
     {
         return context.Workflows.ToList();
     }
 }
开发者ID:riezebosch,项目名称:wf-deploy,代码行数:7,代码来源:WorkflowManager.cs


示例8: OnActivityExecuted

        public override void OnActivityExecuted(WorkflowContext workflowContext, ActivityContext activityContext) {

            // for blocking activities only
            if (!activityContext.Activity.IsEvent) {
                return;
            }

            // activity records pointing to the executed activity
            var inboundActivities = workflowContext.GetInboundTransitions(activityContext.Record);


            // if a direct target of a Branch Activity is executed, then suppress all other direct waiting activities
            var parentBranchActivities = inboundActivities
                .Where(x => x.SourceActivityRecord.Name == this.Name)
                .Select(x => x.SourceActivityRecord)
                .ToList();

            if (parentBranchActivities.Any()) {
                foreach (var parentBranch in parentBranchActivities) {
                    // remove all other waiting activities after the parent branch

                    var siblings = workflowContext.GetOutboundTransitions(parentBranch).Select(x => x.DestinationActivityRecord).ToList();
                    var awaitings = workflowContext.Record.AwaitingActivities.Where(x => siblings.Contains(x.ActivityRecord));
                    foreach (var awaiting in awaitings) {
                        workflowContext.Record.AwaitingActivities.Remove(awaiting);
                    }
                }
            }
        }
开发者ID:RasterImage,项目名称:Orchard,代码行数:29,代码来源:ExclusiveBranchActivity.cs


示例9: CanExecute

        public override bool CanExecute(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            try {

                var contentTypesState = activityContext.GetState<string>("ContentTypes");

                // "" means 'any'
                if (String.IsNullOrEmpty(contentTypesState)) {
                    return true;
                }

                string[] contentTypes = contentTypesState.Split(',');

                var content = workflowContext.Content;

                if (content == null) {
                    return false;
                }

                return contentTypes.Any(contentType => content.ContentItem.TypeDefinition.Name == contentType);
            }
            catch {
                return false;
            }
        }
开发者ID:Timbioz,项目名称:SciGitAzure,代码行数:25,代码来源:ContentActivity.cs


示例10: Run

 /// <summary>
 /// Executes the SwitchStep.  
 /// </summary>
 /// <param name="context">Context for the workflow to run</param>
 /// <param name="stepId">Action name</param>
 /// <returns>State of the workflow after executing the steps.</returns>
 public override string Run(WorkflowContext context, string stepId)
 {
     //var currentState = WorkFlowState.Done.ToString();
     var currentState = string.Empty;
     foreach (WorkflowStep step in WorkflowSteps)
     {
         // Go through each step in order until one is found with a valid condition.
         var caseStep = step as ICaseStep;
         if (caseStep != null)
         {
             if (!String.IsNullOrEmpty(stepId))
             {
                 // Used to run workflow from switch step begin.
                 if (caseStep.CaseContext.Condition.CompareEqualIgnoreCase(stepId))
                 {
                     currentState = this.RunCase(caseStep, ref context, stepId);
                 }
                 // we must be restarting for some reason,  find the case where we last stopped.
                 //if (step.HasStep(stepId))
                 //{
                 //    currentState = this.RunCase(caseStep, ref context, stepId);
                 //    break;
                 //}
             }
             else if (caseStep.IsConditionTrue(context))
             {
                 currentState = this.RunCase(caseStep, ref context, stepId);
                 break;
             }
         }
     }
     return currentState;
 }
开发者ID:snbbgyth,项目名称:WorkFlowEngine,代码行数:39,代码来源:SwitchStep.cs


示例11: CanExecute

        public override bool CanExecute(WorkflowContext workflowContext, ActivityContext activityContext) {
            try {

                var state = activityContext.GetState<string>("CustomForms");

                // "" means 'any'
                if (String.IsNullOrEmpty(state)) {
                    return true;
                }

                var content = workflowContext.Tokens["CustomForm"] as ContentItem;

                if (content == null) {
                    return false;
                }

                var contentManager = content.ContentManager;
                var identities = state.Split(',').Select(x => new ContentIdentity(x));
                var customForms = identities.Select(contentManager.ResolveIdentity);

                return customForms.Any(x => x == content);

            }
            catch {
                return false;
            }
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:27,代码来源:FormSubmittedActivity.cs


示例12: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            var user = workflowContext.Content.As<IUserRoles>();

            // if the current workflow subject is not a user, use current user
            if (user == null) {
                user = _workContextAccessor.GetContext().CurrentUser.As<IUserRoles>();
            }

            var roles = GetRoles(activityContext);

            if (user != null) {
                foreach (var role in roles) {
                    if (!user.Roles.Contains(role)) {
                        var roleRecord = _roleService.GetRoleByName(role);
                        if (roleRecord != null) {
                            _repository.Create(new UserRolesPartRecord {UserId = user.Id, Role = roleRecord});
                        }
                        else {
                            Logger.Debug("Role not found: {0}", role);
                        }
                    }
                }
            }

            yield return T("Done");
        }
开发者ID:Timbioz,项目名称:SciGitAzure,代码行数:27,代码来源:AssignRoleActivity.cs


示例13: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            var part = workflowContext.Content.As<WXMsgPart>();
            var apiUrl = activityContext.GetState<string>("api_url");
            var apiToken = activityContext.GetState<string>("api_token");
            var timestamp = HttpContext.Current.Request.QueryString["timestamp"];
            var nonce = HttpContext.Current.Request.QueryString["nonce"];

            string[] arr = { apiToken, timestamp, nonce };
            Array.Sort(arr);     //字典排序
            string tmpStr = string.Join("", arr);
            var signature = _winXinService.GetSHA1(tmpStr);
            signature = signature.ToLower();

            var client = new System.Net.WebClient();
            client.Encoding = System.Text.Encoding.UTF8;
            var url = string.Format("{0}?timestamp={1}&nonce={2}&signature={3}"
                    , apiUrl, timestamp, nonce, signature);
            string postData = part.XML;
            //using (var stream = HttpContext.Current.Request.InputStream)
            //{
            //    var reader = new StreamReader(stream);
            //    postData = reader.ReadToEnd();
            //}

            string result = null;
            try
            {
                result = client.UploadString(url, postData);
            }
            catch (System.Net.WebException ex)
            {
                string msg = null;
                using (var stream = ex.Response.GetResponseStream())
                {
                    var reader = new StreamReader(stream);
                    msg = reader.ReadToEnd();
                }
                Logger.Warning(ex, ex.Message);
            }
            catch (Exception ex)
            {
                var innerEx = ex;
                while (innerEx.InnerException != null)
                    innerEx = innerEx.InnerException;
                Logger.Warning(ex, innerEx.Message);
            }

            if (result == null)
            {
                yield return T("Error");
            }
            else
            {
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Write(result);
                HttpContext.Current.Response.End();
                yield return T("Success");
            }
        }
开发者ID:ccccccmd,项目名称:Orchard.WeChat,代码行数:60,代码来源:WeiXinDispatchActivity.cs


示例14: CreateVFUI

        /// <summary>
        /// Initializes a new instance of the <see cref="CreateVFUI"/> class.
        /// </summary>
        /// <param name="workstep">the workstep instance</param>
        /// <param name="args">the arguments</param>
        /// <param name="context">the underlying context in which this UI is being used</param>
        public CreateVFUI(CreateVF workstep, CreateVF.Arguments args, WorkflowContext context)
        {
            InitializeComponent();
            this.workstep = workstep;
            this.args = args;
            this.context = context;

            if (args.VectorField != null)
            {
                textBoxK.Text = args.VectorField.koeff.ToString();
                colorPicker1.Color = args.VectorField.arrowColor;
                textBoxN.Text = args.VectorField.partition.ToString();
                if (args.VectorField.haveGrid == true)
                {
                    comboBox1.SelectedItem = comboBox1.Items[0];
                }
                else
                {
                    comboBox1.SelectedItem = comboBox1.Items[1];
                }
                textBoxStep.Text = ((int)args.VectorField.gridStep).ToString();
            }
            workstep.CopyArgumentPackage(args, tmpargs);
            UpdateUiFormArgs();
        }
开发者ID:zumiker,项目名称:OceanVectorfieldC_Sharp,代码行数:31,代码来源:CreateVFUI.cs


示例15: GetPossibleOutcomes

 public override IEnumerable<LocalizedString> GetPossibleOutcomes(WorkflowContext workflowContext, ActivityContext activityContext) {
     return new[] {
         T("InvalidUserNameOrEmail"),
         T("InvalidPassword"),
         T("UserNameOrEmailNotUnique"),
         T("Done")
     };
 }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:8,代码来源:CreateUserActivity.cs


示例16: AddWorkflow

 public void AddWorkflow(Workflow workflow)
 {
     using(var context = new WorkflowContext())
     {
         context.Workflows.Add(workflow);
         context.SaveChanges();
     }
 }
开发者ID:riezebosch,项目名称:wf-deploy,代码行数:8,代码来源:WorkflowManager.cs


示例17: Run

 public override string Run(WorkflowContext workflowContext, string stepId)
 {
     foreach (var workflowStep in WorkflowSteps)
     {
         return workflowStep.Run(workflowContext, stepId);
     }
     return string.Empty;
 }
开发者ID:snbbgyth,项目名称:WorkFlowEngine,代码行数:8,代码来源:CaseStep.cs


示例18: ModifiedKhUI

        //DictionaryProperty ZoneIndexing;
        /// <summary>
        /// Initializes a new instance of the <see cref="ModifiedKhUI"/> class.
        /// </summary>
        /// <param name="workstep">the workstep instance</param>
        /// <param name="args">the arguments</param>
        /// <param name="context">the underlying context in which this UI is being used</param>
        public ModifiedKhUI(PermMatching workstep, PermMatching.Arguments args, WorkflowContext context)
        {
            InitializeComponent();

            this.workstep = workstep;
            this.args = args;
            this.context = context;
        }
开发者ID:walter-poquioma,项目名称:ModifiedKh,代码行数:15,代码来源:ModifiedKhUI.cs


示例19: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
            var notification = activityContext.GetState<string>("Notification");
            var message = activityContext.GetState<string>("Message");

            var notificationType = (NotifyType)Enum.Parse(typeof(NotifyType), notification);
            _notifier.Add(notificationType, T(message));

            yield return T("Done");
        }
开发者ID:bigfont,项目名称:CertifiedOverheadCrane,代码行数:9,代码来源:NotificationActivity.cs


示例20: Execute

        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
            var key = activityContext.GetState<string>("Key");
            var message = activityContext.GetState<string>("ErrorMessage");
            var updater = (IUpdateModel) workflowContext.Tokens["Updater"];

            updater.AddModelError(key, T(message));

            return new[] { T("Done") };
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:9,代码来源:AddModelErrorActivity.cs



注:本文中的WorkflowContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WorkflowExecutionContext类代码示例发布时间:2022-05-24
下一篇:
C# WorkflowAction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap