1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Text; |
---|
4 | |
---|
5 | using Com.Piwigo.Lib.DTO; |
---|
6 | using System.ComponentModel; |
---|
7 | using System.Collections.ObjectModel; |
---|
8 | |
---|
9 | namespace Com.Piwigo.Wpf.DTO |
---|
10 | { |
---|
11 | public abstract class PwgTreeAlbumWPF : INotifyPropertyChanged |
---|
12 | { |
---|
13 | public abstract Int32 Id |
---|
14 | { |
---|
15 | get; |
---|
16 | set; |
---|
17 | } |
---|
18 | |
---|
19 | private String _name; |
---|
20 | public String Name |
---|
21 | { |
---|
22 | set { _name = value; OnPropertyChanged("Name"); } |
---|
23 | get { return _name; } |
---|
24 | } |
---|
25 | |
---|
26 | public event PropertyChangedEventHandler PropertyChanged; |
---|
27 | protected void OnPropertyChanged(String info) |
---|
28 | { |
---|
29 | if (PropertyChanged != null) |
---|
30 | PropertyChanged(this, new PropertyChangedEventArgs(info)); |
---|
31 | } |
---|
32 | |
---|
33 | #region IsExpanded |
---|
34 | |
---|
35 | /// <summary> |
---|
36 | /// Gets/sets whether the TreeViewItem |
---|
37 | /// associated with this object is expanded. |
---|
38 | /// </summary> |
---|
39 | private bool _isExpanded = false; |
---|
40 | public bool IsExpanded |
---|
41 | { |
---|
42 | get { return _isExpanded; } |
---|
43 | set |
---|
44 | { |
---|
45 | if (value != _isExpanded) |
---|
46 | { |
---|
47 | _isExpanded = value; |
---|
48 | this.OnPropertyChanged("IsExpanded"); |
---|
49 | } |
---|
50 | |
---|
51 | // Expand all the way up to the root. |
---|
52 | if (_isExpanded && _parent != null) |
---|
53 | _parent.IsExpanded = true; |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | #endregion // IsExpanded |
---|
58 | |
---|
59 | #region IsSelected |
---|
60 | |
---|
61 | /// <summary> |
---|
62 | /// Gets/sets whether the TreeViewItem |
---|
63 | /// associated with this object is selected. |
---|
64 | /// </summary> |
---|
65 | private bool _isSelected = false; |
---|
66 | public bool IsSelected |
---|
67 | { |
---|
68 | get { return _isSelected; } |
---|
69 | set |
---|
70 | { |
---|
71 | if (value != _isSelected) |
---|
72 | { |
---|
73 | _isSelected = value; |
---|
74 | this.OnPropertyChanged("IsSelected"); |
---|
75 | } |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | #endregion // IsSelected |
---|
80 | |
---|
81 | #region Parents - Childs |
---|
82 | private PwgAlbumWPF _parent = null; |
---|
83 | public abstract PwgAlbumWPF Parent |
---|
84 | { |
---|
85 | get; |
---|
86 | set; |
---|
87 | } |
---|
88 | |
---|
89 | private PwgAlbumListWPF _childrens = null; |
---|
90 | public PwgAlbumListWPF Childrens |
---|
91 | { |
---|
92 | get { return _childrens; } |
---|
93 | set { _childrens = value; this.OnPropertyChanged("Childrens"); } |
---|
94 | } |
---|
95 | |
---|
96 | #endregion // Parent |
---|
97 | } |
---|
98 | |
---|
99 | public class PwgRootAlbumWPF : PwgTreeAlbumWPF |
---|
100 | { |
---|
101 | private Int32 _id = Com.Piwigo.Lib.DTO.PwgAlbum.RootAlbumId; |
---|
102 | public override Int32 Id |
---|
103 | { |
---|
104 | set { throw new SystemException("Couldn't not set the Id for Root Album"); } |
---|
105 | get { return _id; } |
---|
106 | } |
---|
107 | |
---|
108 | private PwgAlbumWPF _parent = null; |
---|
109 | public override PwgAlbumWPF Parent |
---|
110 | { |
---|
111 | get { return _parent; } |
---|
112 | set { throw new SystemException("Couldn't not set Parent for Root Album"); } |
---|
113 | } |
---|
114 | } |
---|
115 | |
---|
116 | public class PwgAlbumWPF : PwgTreeAlbumWPF |
---|
117 | { |
---|
118 | private Int32 _id; |
---|
119 | public override Int32 Id |
---|
120 | { |
---|
121 | set { _id = value; OnPropertyChanged("Id"); } |
---|
122 | get { return _id; } |
---|
123 | } |
---|
124 | |
---|
125 | private ObservableCollection<Int32> _upperAlbumsId; |
---|
126 | public ObservableCollection<Int32> UpperAlbumsId |
---|
127 | { |
---|
128 | set { _upperAlbumsId = value; OnPropertyChanged("UpperAlbumsId"); } |
---|
129 | get { return _upperAlbumsId; } |
---|
130 | } |
---|
131 | |
---|
132 | private Uri _url; |
---|
133 | public Uri Url |
---|
134 | { |
---|
135 | set { _url = value; OnPropertyChanged("Url"); } |
---|
136 | get { return _url; } |
---|
137 | } |
---|
138 | |
---|
139 | private Int64 _imagesCount; |
---|
140 | public Int64 ImagesCount |
---|
141 | { |
---|
142 | set { _imagesCount = value; OnPropertyChanged("ImagesCount"); } |
---|
143 | get { return _imagesCount; } |
---|
144 | } |
---|
145 | |
---|
146 | private Int64 _deepImagesCount; |
---|
147 | public Int64 DeepImagesCount |
---|
148 | { |
---|
149 | set { _deepImagesCount = value; OnPropertyChanged("DeepImagesCount"); } |
---|
150 | get { return _deepImagesCount; } |
---|
151 | } |
---|
152 | |
---|
153 | private Int64 _subAlbumsCount; |
---|
154 | public Int64 SubAlbumsCount |
---|
155 | { |
---|
156 | set { _subAlbumsCount = value; OnPropertyChanged("SubAlbumsCount"); } |
---|
157 | get { return _subAlbumsCount; } |
---|
158 | } |
---|
159 | |
---|
160 | private DateTime _lastDate; |
---|
161 | public DateTime LastDate |
---|
162 | { |
---|
163 | set { _lastDate = value; OnPropertyChanged("LastDate"); } |
---|
164 | get { return _lastDate; } |
---|
165 | } |
---|
166 | |
---|
167 | #region Presentation Members |
---|
168 | |
---|
169 | #region Parents - Childs |
---|
170 | private PwgAlbumWPF _parent = null; |
---|
171 | public override PwgAlbumWPF Parent |
---|
172 | { |
---|
173 | set { _parent = value; OnPropertyChanged("Parent"); } |
---|
174 | get { return _parent; } |
---|
175 | } |
---|
176 | #endregion // Parents - Childs |
---|
177 | #endregion // Presentation Members |
---|
178 | |
---|
179 | #region local Album for import |
---|
180 | private Boolean _isLocal; |
---|
181 | public Boolean IsLocal |
---|
182 | { |
---|
183 | get { return _isLocal; } |
---|
184 | set { _isLocal = value; } |
---|
185 | } |
---|
186 | |
---|
187 | private String _localFile; |
---|
188 | public String LocalFile |
---|
189 | { |
---|
190 | get { return _localFile; } |
---|
191 | set { _localFile = value; } |
---|
192 | } |
---|
193 | #endregion // local Album for import |
---|
194 | } |
---|
195 | } |
---|