프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ServiceBase / Markus.Mvvm.ToolKit / ViewModelBase.cs @ e19522be

이력 | 보기 | 이력해설 | 다운로드 (1.61 KB)

1
using System.Windows.Input;
2

    
3
namespace Markus.Mvvm.ToolKit
4
{
5
    public abstract class ViewModelBase : NotifyExpectation
6
    {
7

    
8
        #region ViewModel Base Binding
9
        
10
        ViewModelBase viewModel;
11

    
12
        public ViewModelBase ViewModel
13
        {
14
            get { return viewModel; }
15
            set { viewModel = value; }
16
        }
17

    
18
        public string Name
19
        {
20
            get { return ViewModel?.Name; }
21
            set
22
            {
23
                if (ViewModel?.Name != value)
24
                {
25
                    ViewModel.Name = value;
26
                    OnPropertyChanged(()=>Name);
27
                }
28
            }
29
        }
30

    
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
    }
74
}
클립보드 이미지 추가 (최대 크기: 500 MB)