blob: e5e4cac782e32909d7c26ded8bf270b84948772c (
plain)
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.Commands;
using Tango.SharedUI;
namespace Tango.MachineStudio.Common.Notifications
{
public abstract class DialogViewVM : ViewModel
{
public event Action Accepted;
public event Action Canceled;
public DialogViewVM()
{
CanClose = true;
CloseCommand = new RelayCommand(Cancel, (x) => CanClose);
}
private bool _canClose;
public bool CanClose
{
get { return _canClose; }
set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
public RelayCommand CloseCommand { get; set; }
public virtual void OnShow()
{
}
protected virtual void Accept()
{
Accepted?.Invoke();
}
protected virtual void Cancel()
{
Canceled?.Invoke();
}
}
}
|