-
Notifications
You must be signed in to change notification settings - Fork 9
/
AddTextCustomDialog.cs
82 lines (64 loc) · 1.8 KB
/
AddTextCustomDialog.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using HanumanInstitute.MvvmDialogs;
using HanumanInstitute.MvvmDialogs.Wpf;
namespace Demo.Wpf.ModalCustomDialog;
public class AddTextCustomDialog : IView, IViewSync
{
private readonly AddTextDialog _dialog = new();
public object RefObj => this;
public void Initialize(INotifyPropertyChanged viewModel, ViewDefinition viewDef)
{
ViewModel = viewModel;
}
public void InitializeExisting(INotifyPropertyChanged viewModel, object view)
{
ViewModel = viewModel;
}
public event EventHandler Closed
{
add => _dialog.Closed += value;
remove => _dialog.Closed -= value;
}
public event EventHandler Loaded
{
add { }
remove { }
}
public event EventHandler<CancelEventArgs> Closing
{
add { }
remove { }
}
public INotifyPropertyChanged ViewModel
{
get => (INotifyPropertyChanged)_dialog.DataContext;
set => _dialog.DataContext = value;
}
public IView? Owner
{
get => _dialog.Owner.AsWrapper();
set => _dialog.Owner = value.AsWrapper()?.Ref;
}
public Task ShowDialogAsync(IView owner) => UiExtensions.RunUiAsync(() => ShowDialog(owner));
public void ShowDialog(IView owner)
{
_dialog.Owner = owner.GetRef();
_dialog.ShowDialog();
}
public void Show(IView? owner)
{
_dialog.Owner = owner.GetRef();
_dialog.Show();
}
public void Activate() => _dialog.Activate();
public void Close() => _dialog.Close();
public bool IsEnabled
{
get => _dialog.IsEnabled;
set => _dialog.IsEnabled = value;
}
public bool IsVisible => _dialog.IsVisible;
public bool ClosingConfirmed { get; set; }
}