mirror of
https://github.com/PrismLibrary/Prism.git
synced 2026-10-20 15:42:19 +08:00
aac688c354
Migrates the Uno Platform E2E sample application from a multi-project structure to the recommended single-project architecture. This update consolidates platform-specific heads into the main `HelloWorld` project and introduces a new `Playground.Module` to showcase Prism for Uno.WinUI features like regions, dialogs, and modularity within the streamlined project setup. It also updates the target framework to .NET 10.
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using Playground.Module.Dialogs;
|
||
|
||
namespace Playground.Module.ViewModels;
|
||
|
||
internal class DialogLabViewModel : BindableBase
|
||
{
|
||
private readonly IDialogService _dialogService;
|
||
private string _lastResult = string.Empty;
|
||
|
||
public DialogLabViewModel(IDialogService dialogService)
|
||
{
|
||
_dialogService = dialogService;
|
||
ShowNotificationCommand = new DelegateCommand(ShowNotification);
|
||
ShowConfirmCommand = new DelegateCommand(ShowConfirm);
|
||
}
|
||
|
||
public string LastResult
|
||
{
|
||
get => _lastResult;
|
||
set => SetProperty(ref _lastResult, value);
|
||
}
|
||
|
||
public DelegateCommand ShowNotificationCommand { get; }
|
||
|
||
public DelegateCommand ShowConfirmCommand { get; }
|
||
|
||
private void ShowNotification()
|
||
{
|
||
_dialogService.ShowDialog(
|
||
nameof(NotificationDialog),
|
||
new DialogParameters
|
||
{
|
||
{ "title", "Notification" },
|
||
{ "message", "This dialog is registered in PlaygroundModule and hosted by Prism’s Uno DialogService." }
|
||
});
|
||
}
|
||
|
||
private void ShowConfirm()
|
||
{
|
||
_dialogService.ShowDialog(
|
||
nameof(ConfirmDialog),
|
||
new DialogParameters { { "message", "Discard unsaved playground changes?" } },
|
||
r => LastResult = $"Confirm dialog closed: {r.Result}");
|
||
}
|
||
}
|