markus / ConvertService / ServiceBase / Markus.Mvvm.ToolKit / ViewModelBase.cs @ e19522be
이력 | 보기 | 이력해설 | 다운로드 (1.61 KB)
1 | 0498c12e | taeseongkim | using System.Windows.Input; |
---|---|---|---|
2 | |||
3 | namespace Markus.Mvvm.ToolKit |
||
4 | 53c9637d | taeseongkim | { |
5 | 45f9a2ad | taeseongkim | public abstract class ViewModelBase : NotifyExpectation |
6 | 53c9637d | taeseongkim | { |
7 | |||
8 | 0498c12e | taeseongkim | #region ViewModel Base Binding |
9 | |||
10 | 53c9637d | taeseongkim | ViewModelBase viewModel; |
11 | |||
12 | public ViewModelBase ViewModel |
||
13 | { |
||
14 | get { return viewModel; } |
||
15 | set { viewModel = value; } |
||
16 | } |
||
17 | |||
18 | public string Name |
||
19 | { |
||
20 | 0498c12e | taeseongkim | get { return ViewModel?.Name; } |
21 | 53c9637d | taeseongkim | set |
22 | { |
||
23 | 0498c12e | taeseongkim | if (ViewModel?.Name != value) |
24 | 53c9637d | taeseongkim | { |
25 | ViewModel.Name = value; |
||
26 | OnPropertyChanged(()=>Name); |
||
27 | } |
||
28 | } |
||
29 | } |
||
30 | 0498c12e | taeseongkim | |
31 | private bool isAcitve; |
||
32 | |||
33 | public bool IsAcitve |
||
34 | { |
||
35 | get { return isAcitve; } |
||
36 | set |
||
37 | { |
||
38 | if (isAcitve != value) |
||
39 | { |
||
40 | isAcitve = value; |
||
41 | OnPropertyChanged(() => isAcitve); |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | |||
46 | #endregion |
||
47 | |||
48 | #region Command |
||
49 | |||
50 | private ICommand _ClosingCommand; |
||
51 | public ICommand ClosingCommand |
||
52 | { |
||
53 | get => _ClosingCommand ?? (_ClosingCommand = new RelayCommand(param => this.Closed())); |
||
54 | } |
||
55 | |||
56 | private ICommand _LoadedCommand; |
||
57 | public ICommand LoadedCommand |
||
58 | { |
||
59 | get => _LoadedCommand ?? (_LoadedCommand = new RelayCommand(param => this.Loaded())); |
||
60 | } |
||
61 | |||
62 | #endregion Command |
||
63 | |||
64 | public virtual void Closed() |
||
65 | { |
||
66 | isAcitve = false; |
||
67 | } |
||
68 | |||
69 | public virtual void Loaded() |
||
70 | { |
||
71 | isAcitve = true; |
||
72 | } |
||
73 | 53c9637d | taeseongkim | } |
74 | } |