34 lines
636 B
C#
34 lines
636 B
C#
|
namespace Setup_Workspace;
|
||
|
|
||
|
public class Runner : Doable
|
||
|
{
|
||
|
public override Task<bool> Do()
|
||
|
{
|
||
|
Console.WriteLine("Running tasks");
|
||
|
return Task.FromResult(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public abstract class Doable
|
||
|
{
|
||
|
public abstract Task<bool> Do();
|
||
|
|
||
|
public List<Doable> Followup = new List<Doable>();
|
||
|
|
||
|
public Doable Then(params Doable[] doables)
|
||
|
{
|
||
|
foreach (var entry in doables)
|
||
|
Followup.Add(entry);
|
||
|
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public async Task Run()
|
||
|
{
|
||
|
if (!await Do())
|
||
|
return;
|
||
|
|
||
|
foreach (var entry in Followup)
|
||
|
entry.Run();
|
||
|
}
|
||
|
}
|