当前位置: 首页>>代码示例>>C#>>正文


C# Workflow类代码示例

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


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

示例1: AddWorkflowWithConstraint

        public void AddWorkflowWithConstraint()
        {
            var childWorkflow = Workflow<string>.Definition() as IWorkflow<string>;
            _parentWorkflow = Workflow<string>.Definition().Do(childWorkflow, If.IsTrue(true)) as Workflow<string>;

            _parentWorkflow.RegisteredOperations.Tasks.Count.ShouldBe(1);
        }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:7,代码来源:WhenDefining.cs

示例2: ShouldDeserializeComplexWorkflowConfiguration3

        public void ShouldDeserializeComplexWorkflowConfiguration3()
        {
            var workFlow = new Workflow();
            workFlow.Configuration = "{\"default_filter\":{\"queue\":\"WQccc\"},\"filters\":[{\"expression\":\"1==1\",\"friendly_name\":\"Prioritizing Filter\",\"targets\":[{\"priority\":\"1\",\"queue\":\"WQccc\",\"timeout\":\"300\"}]}]}";

            var workFlowConfiguration = new WorkflowConfiguration();
            var filter = new Filter
            {
                FriendlyName = "Prioritizing Filter",
                Expression = "1==1",
                Targets = new List<Target>() { 
                    new Target { 
                        Queue="WQccc",
                        Priority="1",
                        Timeout="300"
                    }
                }
            };

            workFlowConfiguration.Filters.Add(filter);
            workFlowConfiguration.DefaultFilter = new Target() { Queue = "WQccc" };

            var config = workFlow.WorkflowConfiguration;

            Assert.AreEqual(workFlowConfiguration.ToString(), config.ToString());
        }
开发者ID:SnapMD,项目名称:twilio-csharp,代码行数:26,代码来源:WorkflowTests.cs

示例3: Init

 public void Init()
 {
     _workStepRepository = new MemoryWorkStepRepository();
     _workItemRepository = new MemoryWorkItemRepository();
     _workflowRepository = new WorkflowRepository(_workItemRepository, _workStepRepository);
     _wp = new Workflow(_workflowRepository);
 }
开发者ID:jorn-ola-birkeland,项目名称:WhiskWork,代码行数:7,代码来源:ParallelWorkStepsTest.cs

示例4: TestMethod1

        public void TestMethod1()
        {
            // Arrange
            WorkflowTestTrace.Arrange();
            var activity = new FileReadToEnd() { FileName = Constants.Workflow1Xaml };
            var tracking = new ListTrackingParticipant();
            var workflow = new Workflow(activity) { Tracking = tracking };

            try
            {
                // Act
                WorkflowTestTrace.Act();
                var result = workflow.Start().Result.Output.Result;

                // Assert
                WorkflowTestTrace.Assert();

                Assert.AreEqual(2113, result.Length);
            }
            finally
            {
                WorkflowTestTrace.Finally();
                workflow.Trace();
            }
        }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:25,代码来源:TaskActivityTest.cs

示例5: TestSavePerson

        public void TestSavePerson()
        {
            var workflow = new Workflow();
            var person = new Person();

            Assert.IsTrue(workflow.SavePerson(new Person() { Name = "Kevin", Age = 26 }));
        }
开发者ID:kevinhicks,项目名称:LocalDBExperiment,代码行数:7,代码来源:WorkFlowTests.cs

示例6: Process

        /// <summary>
        /// Processes the specified <see cref="Rock.Model.Workflow" />
        /// </summary>
        /// <param name="workflow">The <see cref="Rock.Model.Workflow" /> instance to process.</param>
        /// <param name="errorMessages">A <see cref="System.Collections.Generic.List{String}" /> that contains any error messages that were returned while processing the <see cref="Rock.Model.Workflow" />.</param>
        public void Process( Workflow workflow, out List<string> errorMessages )
        {
            workflow.IsProcessing = true;
            this.Context.SaveChanges();

            var rockContext = (RockContext)this.Context;
            workflow.LoadAttributes( rockContext );

            workflow.Process( rockContext, out errorMessages );

            if ( workflow.IsPersisted )
            {
                this.Context.WrapTransaction( () =>
                {
                    this.Context.SaveChanges();
                    workflow.SaveAttributeValues( rockContext );
                    foreach ( var activity in workflow.Activities )
                    {
                        activity.SaveAttributeValues( rockContext );
                    }
                } );

                workflow.IsProcessing = false;
                this.Context.SaveChanges();
            }
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:31,代码来源:WorkflowService.Partial.cs

示例7: Process

        /// <summary>
        /// Processes the specified <see cref="Rock.Model.Workflow" />
        /// </summary>
        /// <param name="workflow">The <see cref="Rock.Model.Workflow" /> instance to process.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="errorMessages">A <see cref="System.Collections.Generic.List{String}" /> that contains any error messages that were returned while processing the <see cref="Rock.Model.Workflow" />.</param>
        /// <returns></returns>
        public bool Process( Workflow workflow, object entity, out List<string> errorMessages )
        {
            var rockContext = (RockContext)this.Context;

            if ( workflow.IsPersisted )
            {
                workflow.IsProcessing = true;
                rockContext.SaveChanges();
            }

            bool result = workflow.ProcessActivities( rockContext, entity, out errorMessages );

            if ( workflow.IsPersisted || workflow.WorkflowType.IsPersisted )
            {
                if ( workflow.Id == 0 )
                {
                    Add( workflow );
                }

                rockContext.WrapTransaction( () =>
                {
                    rockContext.SaveChanges();
                    workflow.SaveAttributeValues( rockContext );
                    foreach ( var activity in workflow.Activities )
                    {
                        activity.SaveAttributeValues( rockContext );
                    }
                } );

                workflow.IsProcessing = false;
                rockContext.SaveChanges();
            }

            return result;
        }
开发者ID:azturner,项目名称:Rock,代码行数:42,代码来源:WorkflowService.Partial.cs

示例8: CheckDataAndCodeIfExist

 public bool CheckDataAndCodeIfExist(Workflow entity)
 {
     if (CheckDataIfExists(entity) || CheckDataIfExists(entity.Code))
     {
         return true;
     }
     return false;
 }
开发者ID:jfvaleroso,项目名称:WMS,代码行数:8,代码来源:WorkflowService.cs

示例9: GetCurrentApproverByWorkflowAndLevel

 public WorkflowMapping GetCurrentApproverByWorkflowAndLevel(Workflow workflow, int level)
 {
     Dictionary<string, object> parameter = new Dictionary<string, object>();
     parameter.Add("Workflow", workflow);
     parameter.Add("LevelId", level);
     WorkflowMapping workflowMapping = this.workflowMappingRepository.GetFilteredData(parameter).FirstOrDefault();
     return workflowMapping;
 }
开发者ID:jfvaleroso,项目名称:WMS,代码行数:8,代码来源:WorkflowMappingService.cs

示例10: ShouldCheckIfConstraintIsNull

        public void ShouldCheckIfConstraintIsNull()
        {
            ICheckConstraint expression = null;
            _pipe = new Workflow<string>();

            var method = new Func<string, string>((s) => { return "result"; });
            Assert.Throws<ArgumentNullException>(() => _pipe.Do(method, expression), "Exception not thrown");
        }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:8,代码来源:WhenDefiningFunctionalPipe.cs

示例11: ShouldRepeatOperation

        public void ShouldRepeatOperation()
        {
            IWorkflow<Colour> workflow = new Workflow<Colour>();
            workflow.Do<DuplicateName>().Repeat().Twice();
            var result = workflow.Start(new Colour("Red"));

            result.Name.ShouldBe("RedRedRedRedRedRedRedRed");
        }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:8,代码来源:RepeatUntil.cs

示例12: TestFindAllPeople

        public void TestFindAllPeople()
        {
            var workflow = new Workflow();

            workflow.SavePerson(new Person() { Name = "Bubba" });

            Assert.AreNotEqual(0, workflow.FindAllPeople().Count);
        }
开发者ID:kevinhicks,项目名称:LocalDBExperiment,代码行数:8,代码来源:WorkFlowTests.cs

示例13: Freeze

 public Freeze(Workflow p, IntPtr windowHandle)
 {
     if (p.ActiveWindowGDIFreezeWindow)
     {
         NativeMethods.GetWindowThreadProcessId(windowHandle, out processId);
         FreezeThreads((int)processId);
     }
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:8,代码来源:Freeze.cs

示例14: TestRemovedPersonsShouldNoLongerBeFindable

        public void TestRemovedPersonsShouldNoLongerBeFindable()
        {
            var workflow = new Workflow();

            workflow.SavePerson(new Person() { Name = "Levi"});
            workflow.RemovePerson("Levi");

            Assert.IsNull(workflow.FindPerson("Levi"));
        }
开发者ID:kevinhicks,项目名称:LocalDBExperiment,代码行数:9,代码来源:WorkFlowTests.cs

示例15: Archive

        /// <summary>
        /// Archives a workflow, moving it into the completed store.
        /// </summary>
        /// <param name="workflow">The workflow to archive.</param>
        public override void Archive(Workflow workflow)
        {
            var coll = GetCollection();
            coll.Remove(_queryById(workflow.Id));

            var collCompleted = GetCompletedCollection();
            collCompleted.Insert(new CompletedWorkflow(workflow));

        }
开发者ID:rajeshgupthar,项目名称:Stateless.WorkflowEngine,代码行数:13,代码来源:MongoDbWorkflowStore.cs


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