mirror of
https://github.com/PrismLibrary/Prism.git
synced 2026-10-28 21:07:24 +08:00
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using Prism.Commands;
|
|
using Prism.Mvvm;
|
|
using Prism.Dialogs;
|
|
using HelloWorld.Core;
|
|
|
|
namespace HelloWorld.Modules.ModuleA.ViewModels
|
|
{
|
|
public class ViewAViewModel : BindableBase
|
|
{
|
|
private string _message;
|
|
public string Message
|
|
{
|
|
get { return _message; }
|
|
set { SetProperty(ref _message, value); }
|
|
}
|
|
|
|
private DelegateCommand _showDialogCommand;
|
|
private readonly IDialogService _dialogService;
|
|
|
|
public DelegateCommand ShowDialogCommand =>
|
|
_showDialogCommand ?? (_showDialogCommand = new DelegateCommand(ExecuteShowDialogCommand));
|
|
|
|
void ExecuteShowDialogCommand()
|
|
{
|
|
_dialogService.ShowNotification("Hello There!", r =>
|
|
{
|
|
if (r.Result == ButtonResult.OK)
|
|
Message = "OK was clicked";
|
|
else
|
|
Message = "Something else was clicked";
|
|
});
|
|
}
|
|
|
|
public ViewAViewModel(IDialogService dialogService)
|
|
{
|
|
Message = "Hello from ViewA in Module A";
|
|
_dialogService = dialogService;
|
|
}
|
|
}
|
|
}
|