Preview refactor, Console rename form

This commit is contained in:
2023-08-14 16:42:22 +02:00
parent 2a595b2548
commit 8aa8d83598
25 changed files with 610 additions and 348 deletions

View File

@@ -1,13 +1,19 @@
namespace TerminalUI;
using Microsoft.Extensions.Logging;
namespace TerminalUI;
public class EventLoop : IEventLoop
{
private readonly IApplicationContext _applicationContext;
private readonly ILogger<EventLoop> _logger;
private readonly List<Action> _permanentQueue = new();
public EventLoop(IApplicationContext applicationContext)
public EventLoop(
IApplicationContext applicationContext,
ILogger<EventLoop> logger)
{
_applicationContext = applicationContext;
_logger = logger;
}
public void AddToPermanentQueue(Action action) => _permanentQueue.Add(action);
@@ -26,7 +32,14 @@ public class EventLoop : IEventLoop
{
foreach (var action in _permanentQueue)
{
action();
try
{
action();
}
catch (Exception e)
{
_logger.LogError(e, "Error while processing action in permanent queue");
}
}
}
}