Console DialogService

This commit is contained in:
2023-08-14 11:50:59 +02:00
parent 6797c26bf9
commit 1f4b938358
41 changed files with 807 additions and 269 deletions

View File

@@ -1,5 +1,7 @@
using FileTime.App.CommandPalette.ViewModels;
using FileTime.App.Core.ViewModels;
using FileTime.ConsoleUI.App.Services;
using FileTime.Core.Interactions;
namespace FileTime.ConsoleUI.App;
@@ -10,14 +12,29 @@ public class RootViewModel : IRootViewModel
public IPossibleCommandsViewModel PossibleCommands { get; }
public IConsoleAppState AppState { get; }
public ICommandPaletteViewModel CommandPalette { get; }
public IDialogService DialogService { get; }
public event Action<IInputElement>? FocusReadInputElement;
public RootViewModel(
IConsoleAppState appState,
IPossibleCommandsViewModel possibleCommands,
ICommandPaletteViewModel commandPalette)
ICommandPaletteViewModel commandPalette,
IDialogService dialogService)
{
AppState = appState;
PossibleCommands = possibleCommands;
CommandPalette = commandPalette;
DialogService = dialogService;
DialogService.ReadInput.PropertyChanged += (o, e) =>
{
if (e.PropertyName == nameof(DialogService.ReadInput.Value))
{
if (DialogService.ReadInput.Value is {Inputs.Count: > 0} readInputs)
{
FocusReadInputElement?.Invoke(readInputs.Inputs[0]);
}
}
};
}
}