-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectViewModel.cs
More file actions
113 lines (105 loc) · 2.69 KB
/
ProjectViewModel.cs
File metadata and controls
113 lines (105 loc) · 2.69 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using GalaSoft.MvvmLight;
using System;
using System.Runtime.CompilerServices;
using System.Windows.Media;
namespace Pin
{
public class ProjectViewModel : ViewModelBase
{
protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
RaisePropertyChanged(propertyName);
}
private bool _Vis_ProjectView = false;
public bool Vis_ProjectView
{
get
{
return _Vis_ProjectView;
}
set
{
_Vis_ProjectView = value;
RaisePropertyChanged();
}
}
private Model.Project _Project;
public Model.Project Project
{
get
{
return _Project;
}
set
{
_Project = value;
UpdateAllProperties();
}
}
private delegate void Properties();
Properties UpdateAllProperties;
public ProjectViewModel(Model.Project project)
{
UpdateAllProperties = new Properties(
() => NotifyPropertyChanged("ProjectName"));
UpdateAllProperties += () => NotifyPropertyChanged("ProjectPath");
UpdateAllProperties += () => NotifyPropertyChanged("FillColor");
Project = project;
}
public void SaveProperties()
{
ProjectViewModelList.Instance.Update(this,Project);
}
public void DeleteProperties()
{
ProjectViewModelList.Instance.Delete(this, Project);
}
public string ProjectName
{
get
{
return _Project.Name;
}
set
{
_Project.Name = value;
NotifyPropertyChanged();
}
}
public string ProjectPath
{
get
{
return _Project.Path;
}
set
{
_Project.Path = value;
NotifyPropertyChanged();
}
}
public Brush FillColor
{
get
{
return _Project.Color;
}
set
{
_Project.Color = value;
NotifyPropertyChanged();
}
}
public override bool Equals(object obj)
{
if(obj is ProjectViewModel)
{
return Project.Equals(((ProjectViewModel)obj).Project);
}
else
{
return Project.Equals(obj);
}
}
}
}