source: extensions/PiwigoLib/PiwigoWpf/DTO/PwgCategoryWPF.cs @ 11936

Last change on this file since 11936 was 11936, checked in by bayral, 13 years ago

local cateoroy for import

File size: 5.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using Com.Piwigo.Lib.DTO;
6using System.ComponentModel;
7using System.Collections.ObjectModel;
8
9namespace Com.Piwigo.Wpf.DTO
10{
11    public abstract class PwgTreeCategoryWPF : 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 PwgCategoryWPF _parent = null;
83        public abstract PwgCategoryWPF Parent
84        {
85            get;
86            set;
87        }
88
89        private PwgCategoryListWPF _childrens = null;
90        public PwgCategoryListWPF Childrens
91        {
92            get { return _childrens; }
93            set { _childrens = value; this.OnPropertyChanged("Childrens"); }
94        }
95
96        #endregion // Parent
97    }
98
99    public class PwgRootCategoryWPF : PwgTreeCategoryWPF
100    {
101        private Int32 _id = Com.Piwigo.Lib.DTO.PwgCategory.RootCategoryId;
102        public override Int32 Id
103        {
104            set { throw new SystemException("Couldn't not set the Id for Root category"); }
105            get { return _id; }
106        }
107 
108        private PwgCategoryWPF _parent = null;
109        public override PwgCategoryWPF Parent
110        {
111            get { return _parent; }
112            set { throw new SystemException("Couldn't not set Parent for Root category"); }
113        }
114    }
115
116    public class PwgCategoryWPF : PwgTreeCategoryWPF
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> _upperCategoriesId;
126        public  ObservableCollection<Int32> UpperCategoriesId
127        {
128            set { _upperCategoriesId = value; OnPropertyChanged("UpperCategoriesId"); }
129            get { return _upperCategoriesId; }
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 _subCategoriesCount;
154        public Int64 SubCategoriesCount
155        {
156            set { _subCategoriesCount = value; OnPropertyChanged("SubCategoriesCount"); }
157            get { return _subCategoriesCount; }
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 PwgCategoryWPF _parent = null;
171        public override PwgCategoryWPF 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 category 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 category for import
194    }
195}
Note: See TracBrowser for help on using the repository browser.