This commit is contained in:
2022-06-09 17:49:34 +02:00
parent 9d48caaa58
commit 0b3fe30fec
24 changed files with 254 additions and 34 deletions

View File

@@ -63,7 +63,7 @@ public static class MainConfiguration
new CommandBindingConfiguration(GoToPathCommand.CommandName, new[] { Key.G, Key.P }),
new CommandBindingConfiguration(GoToProviderCommand.CommandName, new[] { Key.G, Key.T }),
new CommandBindingConfiguration(GoToRootCommand.CommandName, new[] { Key.G, Key.R }),
//new CommandBindingConfiguration(ConfigCommand.HardDelete, new[] { new KeyConfig(Key.D,shift: true), new KeyConfig(Key.D, shift: true) }),
new CommandBindingConfiguration(DeleteCommand.HardDeleteCommandName, new[] { new KeyConfig(Key.D,shift: true), new KeyConfig(Key.D, shift: true) }),
new CommandBindingConfiguration(MarkCommand.CommandName, Key.Space),
new CommandBindingConfiguration(MoveCursorToLastCommand.CommandName, new KeyConfig(Key.G, shift: true)),
new CommandBindingConfiguration(MoveCursorToFirstCommand.CommandName, new[] { Key.G, Key.G }),
@@ -82,7 +82,7 @@ public static class MainConfiguration
//new CommandBindingConfiguration(ConfigCommand.RunCommand, new KeyConfig(Key.D4, shift: true)),
//new CommandBindingConfiguration(ConfigCommand.ScanContainerSize, new[] { Key.C, Key.S }),
//new CommandBindingConfiguration(ConfigCommand.ShowAllShortcut, Key.F1),
//new CommandBindingConfiguration(ConfigCommand.SoftDelete, new[] { new KeyConfig(Key.D), new KeyConfig(Key.D, shift: true) }),
new CommandBindingConfiguration(DeleteCommand.SoftDeleteCommandName, new[] { new KeyConfig(Key.D), new KeyConfig(Key.D, shift: true) }),
new CommandBindingConfiguration(SwitchToTabCommand.SwitchToLastTabCommandName, Key.D9),
new CommandBindingConfiguration(SwitchToTabCommand.SwitchToTab1CommandName, Key.D1),
new CommandBindingConfiguration(SwitchToTabCommand.SwitchToTab2CommandName, Key.D2),

View File

@@ -1,3 +1,4 @@
using FileTime.App.Core.Models;
using FileTime.Core.Interactions;
using FileTime.GuiApp.ViewModels;
@@ -6,5 +7,6 @@ namespace FileTime.GuiApp.Services;
public interface IDialogService : IUserCommunicationService
{
IObservable<ReadInputsViewModel?> ReadInput { get; }
IObservable<MessageBoxViewModel?> LastMessageBox { get; }
void ReadInputs(IEnumerable<IInputElement> inputs, Action inputHandler, Action? cancelHandler = null);
}

View File

@@ -10,7 +10,6 @@ public interface IGuiAppState : IAppState
List<KeyConfig> PreviousKeys { get; }
bool IsAllShortcutVisible { get; set; }
bool NoCommandFound { get; set; }
string? MessageBoxText { get; set; }
List<CommandBindingConfiguration> PossibleCommands { get; set; }
BindedCollection<RootDriveInfo, string> RootDriveInfos { get; set; }
IReadOnlyList<PlaceInfo> Places { get; set; }

View File

@@ -0,0 +1,31 @@
using FileTime.App.Core.ViewModels;
using FileTime.Core.Interactions;
using MvvmGen;
namespace FileTime.GuiApp.ViewModels;
[ViewModel]
public partial class MessageBoxViewModel : IModalViewModel
{
private readonly Action<MessageBoxViewModel, MessageBoxResult> _handler;
public string Text { get; }
public string Name => "MessageBoxViewModel";
public MessageBoxViewModel(string text, Action<MessageBoxViewModel, MessageBoxResult> handler)
{
_handler = handler;
Text = text;
}
[Command]
public void Ok()
{
_handler.Invoke(this, MessageBoxResult.Ok);
}
[Command]
public void Cancel()
{
_handler.Invoke(this, MessageBoxResult.Cancel);
}
}

View File

@@ -7,7 +7,7 @@ namespace FileTime.GuiApp.ViewModels;
[ViewModel]
[Inject(typeof(Action<ReadInputsViewModel>), "_cancel")]
[Inject(typeof(Action<ReadInputsViewModel>), "_process")]
public partial class ReadInputsViewModel : IModalViewModelBase
public partial class ReadInputsViewModel : IModalViewModel
{
public string Name => "ReadInputs";
public List<IInputElement> Inputs { get; set; }