-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathViewBetaViewModel.cs
More file actions
52 lines (46 loc) · 1.35 KB
/
ViewBetaViewModel.cs
File metadata and controls
52 lines (46 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using Lemon.ModuleNavigation.Abstractions;
using Lemon.ModuleNavigation.Core;
using ReactiveUI;
using System.Reactive;
namespace Lemon.ModuleNavigation.SampleViewModel;
public class ViewBetaViewModel : BaseNavigationViewModel, IDialogAware
{
public string Title => nameof(ViewBetaViewModel);
public override string? Alias => "BetaView";
public event Action<IDialogResult>? RequestClose;
public ReactiveCommand<Unit, Unit> CloseCommand => ReactiveCommand.Create(() =>
{
var param = new DialogParameters
{
{ "from", nameof(ViewBetaViewModel) }
};
RequestClose?.Invoke(new DialogResult(ButtonResult.OK, param));
});
private bool _isDialog = false;
public bool IsDialog
{
get => _isDialog;
set
{
this.RaiseAndSetIfChanged(ref _isDialog, value);
}
}
public void OnDialogClosed()
{
}
public void OnDialogOpened(IDialogParameters? parameters)
{
IsDialog = true;
}
public override bool IsNavigationTarget(NavigationContext navigationContext)
{
if (navigationContext.Parameters is not null)
{
if (navigationContext.Parameters.TryGetValue("requestNew", out bool requestNew))
{
return !requestNew;
}
}
return true;
}
}