簡體   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