Console DialogService
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user