Initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
|
||||
using CommandHandler.Navigation;
|
||||
|
||||
namespace CommandHandler.Commands;
|
||||
|
||||
internal class ChangeNavigationStateCommand(INavigationContext context, INavigationState state) : ICommand
|
||||
{
|
||||
public Task Execute()
|
||||
{
|
||||
context.SetState(state);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace CommandHandler.Commands;
|
||||
|
||||
internal class CombinedCommand(params ICommand[] commands) : ICommand
|
||||
{
|
||||
public async Task Execute()
|
||||
{
|
||||
foreach (var command in commands)
|
||||
{
|
||||
await command.Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using CommandHandler.Navigation;
|
||||
|
||||
namespace CommandHandler.Commands;
|
||||
|
||||
internal class DrawMenuCommand(INavigationDrawer navigationDrawer) : ICommand
|
||||
{
|
||||
public Task Execute()
|
||||
{
|
||||
Console.Write(navigationDrawer.DrawNavigationMenu());
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace CommandHandler.Commands;
|
||||
|
||||
internal class EmptyCommand : ICommand
|
||||
{
|
||||
public Task Execute()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace CommandHandler.Commands;
|
||||
|
||||
internal class ExitCommand : ICommand
|
||||
{
|
||||
public Task Execute()
|
||||
{
|
||||
ApplicationContext.IsRan = false;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CommandHandler.Commands;
|
||||
|
||||
internal interface ICommand
|
||||
{
|
||||
Task Execute();
|
||||
}
|
||||
Reference in New Issue
Block a user