Some reworks for stuff
This commit is contained in:
parent
ed4e813881
commit
8e8fdd9a0b
5 changed files with 87 additions and 19 deletions
34
src/Runner.cs
Normal file
34
src/Runner.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue