Try to let it work

This commit is contained in:
2020-07-20 21:59:30 +02:00
parent 7ad587228a
commit b1d1f2a396
6 changed files with 114 additions and 47 deletions

View File

@ -3,6 +3,7 @@ using Dialogs;
using ModernWpf;
using ModernWpfPlayground.Types;
using Prism.Ioc;
using Prism.Services.Dialogs;
namespace ModernWpfPlayground
{
@ -21,6 +22,7 @@ namespace ModernWpfPlayground
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterSingleton<IDialogService, Dialogs.DialogService>();
containerRegistry.Register<MainWindow>();
containerRegistry.Register<MainWindowViewModel>();
containerRegistry.RegisterDialog<MessageBoxView, MessageBoxViewModel>();

View File

@ -8,6 +8,7 @@ using Microsoft.Win32;
using ModernWpfPlayground.MvvmStuff;
using ModernWpfPlayground.Types;
using Prism.Commands;
using Prism.Logging;
using Prism.Services.Dialogs;
using YamlDotNet.Serialization;
using static ModernWpf.ThemeManager;
@ -18,15 +19,17 @@ namespace ModernWpfPlayground
public class MainWindowViewModel : BaseViewModel
{
private readonly IDialogService _service;
private readonly ILoggerFacade _logger;
private const string AppName = "TaBEA 3.0.0";
private string? _path;
private string _title = AppName;
private readonly ISerializer _serializer;
private readonly IDeserializer _deserializer;
public MainWindowViewModel(IDialogService service)
public MainWindowViewModel(IDialogService service, ILoggerFacade logger)
{
_service = service;
_logger = logger;
ShowDialogCommand = new DelegateCommand(ShowDialog);
CloseCommand = new DelegateCommand(() => Application.Current.Shutdown());
OpenViewModelCommand = new DelegateCommand(LoadViewModel);
@ -135,12 +138,12 @@ namespace ModernWpfPlayground
private void ShowDialogService()
{
void executeCallBack(IDialogResult result)
static void ExecuteCallBack(IDialogResult result)
{
MessageBox.Show(Application.Current.MainWindow, "DialogResult = " + result.Result);
}
_service.Show(nameof(MessageBoxView), default, executeCallBack);
_service.ShowDialog(nameof(MessageBoxView), default, ExecuteCallBack);
}