繁体   English   中英

设计模式来处理顺序任务C#

[英]design pattern to handle sequential tasks c#

我正在努力寻找创建有时共享步骤的多个工作流的好方法。 是否有任何好的资源可以解决这些问题,并在步骤之间实施“ Required-Rule”。

public class Weekday
{
    // Initial Step
    public BreakfastStep BreakfastStep { get; set; }

    // Breakfast step required
    public WorkStep WorkStep { get; set; }

    // Work step required
    public ExerciseStep ExerciseStep { get; set; }
}

public class Weekend
{
    // Initial Step
    public BreakfastStep BreakfastStep { get; set; }

    // Breakfast step required
    public ExerciseStep ExerciseStep { get; set; }
}

public class ExerciseStep
{
    public bool ChangeClothesComplete { get; set; }
    public bool RunEnabled => ChangeClothesComplete;
    public bool RunComplete { get; set; }
    public bool ShowerEnabled => RunComplete;
    public bool ShowerComplete { get; set; }
}

public class BreakfastStep
{
    public bool GetItemsComplete { get; set; }
    public bool MakeSandwichEnabled => GetItemsComplete;
    public bool MakeSandwichComplete { get; set; }
    public bool EatSandwichEnabled => MakeSandwichComplete;
    public bool EatSandwichComplete { get; set; }
}

public class WorkStep
{
    public bool CommuteComplete { get; set; }
    public bool DoWorkEnabled => CommuteComplete;
    public bool DoWorkComplete { get; set; }
    public bool CommuteBackHomeEnabled => DoWorkComplete;
    public bool CommuteBackHomeComplete { get; set; }
}

您应该看看状态设计模式。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM