using System; using System.Collections.Generic; using System.Text; using Com.Piwigo.Lib.DTO; using System.ComponentModel; using System.Collections.ObjectModel; namespace Com.Piwigo.Wpf.DTO { public abstract class PwgTreeCategoryWPF : INotifyPropertyChanged { public abstract Int32 Id { get; set; } private String _name; public String Name { set { _name = value; OnPropertyChanged("Name"); } get { return _name; } } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(String info) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info)); } #region IsExpanded /// /// Gets/sets whether the TreeViewItem /// associated with this object is expanded. /// private bool _isExpanded = false; public bool IsExpanded { get { return _isExpanded; } set { if (value != _isExpanded) { _isExpanded = value; this.OnPropertyChanged("IsExpanded"); } // Expand all the way up to the root. if (_isExpanded && _parent != null) _parent.IsExpanded = true; } } #endregion // IsExpanded #region IsSelected /// /// Gets/sets whether the TreeViewItem /// associated with this object is selected. /// private bool _isSelected = false; public bool IsSelected { get { return _isSelected; } set { if (value != _isSelected) { _isSelected = value; this.OnPropertyChanged("IsSelected"); } } } #endregion // IsSelected #region Parents - Childs private PwgCategoryWPF _parent = null; public abstract PwgCategoryWPF Parent { get; set; } private PwgCategoryListWPF _childrens = null; public PwgCategoryListWPF Childrens { get { return _childrens; } set { _childrens = value; this.OnPropertyChanged("Childrens"); } } #endregion // Parent } public class PwgRootCategoryWPF : PwgTreeCategoryWPF { private Int32 _id = Com.Piwigo.Lib.DTO.PwgCategory.RootCategoryId; public override Int32 Id { set { throw new SystemException("Couldn't not set the Id for Root category"); } get { return _id; } } private PwgCategoryWPF _parent = null; public override PwgCategoryWPF Parent { get { return _parent; } set { throw new SystemException("Couldn't not set Parent for Root category"); } } } public class PwgCategoryWPF : PwgTreeCategoryWPF { private Int32 _id; public override Int32 Id { set { _id = value; OnPropertyChanged("Id"); } get { return _id; } } private ObservableCollection _upperCategoriesId; public ObservableCollection UpperCategoriesId { set { _upperCategoriesId = value; OnPropertyChanged("UpperCategoriesId"); } get { return _upperCategoriesId; } } private Uri _url; public Uri Url { set { _url = value; OnPropertyChanged("Url"); } get { return _url; } } private Int64 _imagesCount; public Int64 ImagesCount { set { _imagesCount = value; OnPropertyChanged("ImagesCount"); } get { return _imagesCount; } } private Int64 _deepImagesCount; public Int64 DeepImagesCount { set { _deepImagesCount = value; OnPropertyChanged("DeepImagesCount"); } get { return _deepImagesCount; } } private Int64 _subCategoriesCount; public Int64 SubCategoriesCount { set { _subCategoriesCount = value; OnPropertyChanged("SubCategoriesCount"); } get { return _subCategoriesCount; } } private DateTime _lastDate; public DateTime LastDate { set { _lastDate = value; OnPropertyChanged("LastDate"); } get { return _lastDate; } } #region Presentation Members #region Parents - Childs private PwgCategoryWPF _parent = null; public override PwgCategoryWPF Parent { set { _parent = value; OnPropertyChanged("Parent"); } get { return _parent; } } #endregion // Parents - Childs #endregion // Presentation Members #region local category for import private Boolean _isLocal; public Boolean IsLocal { get { return _isLocal; } set { _isLocal = value; } } private String _localFile; public String LocalFile { get { return _localFile; } set { _localFile = value; } } #endregion // local category for import } }