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

C# Workflow类代码示例

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

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



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


示例16: DrawLayer

   void DrawLayer(MaterialEditor editor, int i, MaterialProperty[] props, string[] keyWords, Workflow workflow, 
      bool hasGloss, bool hasSpec, bool isParallax, bool hasEmis, bool hasDistBlend)
   {
      EditorGUIUtility.labelWidth = 0f;
      var albedoMap = FindProperty ("_Tex" + i, props);
      var tint = FindProperty("_Tint" + i, props);
      var normalMap = FindProperty ("_Normal" + i, props);
      var smoothness = FindProperty("_Glossiness" + i, props);
      var glossinessMap = FindProperty("_GlossinessTex" + i, props, false);
      var metallic = FindProperty("_Metallic" + i, props, false);
      var emissionTex = FindProperty("_Emissive" + i, props);
      var emissionMult = FindProperty("_EmissiveMult" + i, props);
      var parallax = FindProperty("_Parallax" + i, props);
      var texScale = FindProperty("_TexScale" + i, props);
      var specMap = FindProperty("_SpecGlossMap" + i, props, false);
      var specColor = FindProperty("_SpecColor" + i, props, false);
      var distUVScale = FindProperty("_DistUVScale" + i, props, false);

      editor.TexturePropertySingleLine(new GUIContent("Albedo/Height"), albedoMap);
      editor.ShaderProperty(tint, "Tint");
      editor.TexturePropertySingleLine(new GUIContent("Normal"), normalMap);
      if (workflow == Workflow.Metallic)
      {
         editor.TexturePropertySingleLine(new GUIContent("Metal(R)/Smoothness(A)"), glossinessMap);
      }
      else
      {
         editor.TexturePropertySingleLine(new GUIContent("Specular(RGB)/Gloss(A)"), specMap);
      }
      if (workflow == Workflow.Metallic && !hasGloss)
      { 
         editor.ShaderProperty(smoothness, "Smoothness");
         editor.ShaderProperty(metallic, "Metallic");
      }
      else if (workflow == Workflow.Specular && !hasSpec)
      {
         editor.ShaderProperty(smoothness, "Smoothness");
         editor.ShaderProperty(specColor, "Specular Color");
      }
      editor.TexturePropertySingleLine(new GUIContent("Emission"), emissionTex);
      editor.ShaderProperty(emissionMult, "Emissive Multiplier");

      editor.ShaderProperty(texScale, "Texture Scale");
      if (hasDistBlend)
      {
         editor.ShaderProperty(distUVScale, "Distance UV Scale");
      }
      if (isParallax)
      {
         editor.ShaderProperty(parallax, "Parallax Height");
      }

      if (i != 1)
      {
         editor.ShaderProperty(FindProperty("_Contrast"+i, props), "Interpolation Contrast");
      }
   }
开发者ID:ArieLeo,项目名称:VertexPaint,代码行数:57,代码来源:SplatMapShaderGUI.cs


示例17: ShouldNotRetrySuccessfulOperation

        public void ShouldNotRetrySuccessfulOperation()
        {
            var workflow = new Workflow<Colour>();
                workflow.Do<DuplicateName>().Retry().Twice();

            var result = workflow.Start(new Colour("Red"));

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


示例18: ShouldSetResultAfterExecuting

        public void ShouldSetResultAfterExecuting()
        {
            BasicOperation<Colour> doublespace = new DoubleSpace();
            var flow = new Workflow<Colour>();
            flow.Do(doublespace);
            flow.Start(new Colour("Red"));

            Assert.That(doublespace.SuccessResult, Is.True);
        }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:9,代码来源:WhenExecutingOperation.cs


示例19: BeforeEachTest

 public void BeforeEachTest()
 {
     _red = new Colour("Red");
     _pipe = new Workflow<Colour>();
     _pipe.Do(new WorkflowMemoryLoader<Colour>(_red));
     _doublespace = new DoubleSpace();
     _doublespaceOne = new DoubleSpace();
     _doubleSpaceTwo = new DoubleSpace();
 }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:9,代码来源:WorkFlowSyntax.cs


示例20: TestSavedPersonShouldBeReturnedWithGetPerson

        public void TestSavedPersonShouldBeReturnedWithGetPerson()
        {
            var workflow = new Workflow();
            workflow.SavePerson(new Person() { Name = "Alibaba", Age = 46 });
            var person = workflow.FindPerson("Alibaba");

            Assert.IsNotNull(person);
            Assert.AreEqual("Alibaba", person.Name);
            Assert.AreEqual(46, person.Age);
        }
开发者ID:kevinhicks,项目名称:LocalDBExperiment,代码行数:10,代码来源:WorkFlowTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# WorkflowAction类代码示例发布时间:2022-05-24
下一篇:
C# WorkerThread类代码示例发布时间: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