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

@@ -0,0 +1,31 @@
using FileTime.Core.Interactions;
namespace FileTime.App.Core.ViewModels;
public class MessageBoxViewModel : IModalViewModel
{
private readonly Action<MessageBoxViewModel, MessageBoxResult> _handler;
public string Text { get; }
public bool ShowCancel { get; }
public string OkText { get; }
public string CancelText { get; }
public string Name => "MessageBoxViewModel";
public MessageBoxViewModel(
string text,
Action<MessageBoxViewModel, MessageBoxResult> handler,
bool showCancel = true,
string? okText = null,
string? cancelText = null)
{
_handler = handler;
Text = text;
ShowCancel = showCancel;
OkText = okText ?? "Yes";
CancelText = cancelText ?? "No";
}
public void Ok() => _handler.Invoke(this, MessageBoxResult.Ok);
public void Cancel() => _handler.Invoke(this, MessageBoxResult.Cancel);
}