|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CBR.Core.Helpers;
using System.Reflection;
using System.IO;
using System.Windows.Media.Imaging;
using System.Threading;
using System.Windows;
using SevenZip;
using System.Configuration;
using System.Windows.Threading;
using CBR.Core.Services;
using System.Collections.ObjectModel;
using System.Dynamic;
using System.ComponentModel;
using CBR.Core.Files;
namespace CBR.Core.Models
{
public class Book : BindableObject
{
#region -----------------CONSTRUCTOR-----------------
public Book()
{
}
public Book(string fileinfo, string filePath)
{
FilePath = filePath;
BookInfoFilePath = fileinfo;
}
#endregion
#region -----------------PROPERTIES-----------------
private object _Tag = null;
[Browsable(false)]
public object Tag
{
get { return _Tag; }
set { _Tag = value; }
}
private string _bookInfoFilePath = string.Empty;
[Browsable(false)]
public string BookInfoFilePath
{
get { return _bookInfoFilePath; }
set { _bookInfoFilePath = value; IsDirty = true; RaisePropertyChanged("BookInfoFilePath"); }
}
private string _filePath = string.Empty;
[Browsable(true)]
[Description("File path")]
public string FilePath
{
get { return _filePath; }
set { _filePath = value; IsDirty = true; RaisePropertyChanged("FilePath"); }
}
private List<Page> _Pages = null;
[Browsable(false)]
public List<Page> Pages
{
get { if (_Pages == null) _Pages = new List<Page>(); return _Pages; }
set { _Pages = value; IsDirty = true; }
}
private string _Bookmark = string.Empty;
[Browsable(false)]
[Description("Bookmarked page")]
public string Bookmark
{
get { return _Bookmark; }
set { _Bookmark = value; IsDirty = true; RaisePropertyChanged("Bookmark"); }
}
private bool _IsRead = false;
[Browsable(true)]
[Description("Read flag")]
public bool IsRead
{
get { return _IsRead; }
set { _IsRead = value; IsDirty = true; RaisePropertyChanged("IsRead"); }
}
private bool _IsSecured = false;
[Browsable(true)]
[Description("Secured")]
public bool IsSecured
{
get { return _IsSecured; }
set { _IsSecured = value; IsDirty = true; RaisePropertyChanged("IsSecured"); }
}
private string _Password= string.Empty;
[Browsable(false)]
public string Password
{
get { return _Password; }
set { _Password = value; IsDirty = true; }
}
private BitmapImage _Cover = null;
[Browsable(false)]
public BitmapImage Cover
{
get { return _Cover; }
set { _Cover = value; IsDirty = true; RaisePropertyChanged("Cover"); }
}
private int _PageCount;
[Browsable(true)]
[Description("Page count")]
public int PageCount
{
get { return _PageCount; }
set { _PageCount = value; IsDirty = true; RaisePropertyChanged("PageCount"); }
}
private long _Size;
[Browsable(true)]
[Description("File size")]
public long Size
{
get { return _Size; }
set { _Size = value; IsDirty = true; RaisePropertyChanged("Size"); }
}
private int _Rating;
[Browsable(true)]
[Description("Rating")]
public int Rating
{
get { return _Rating; }
set { _Rating = value; IsDirty = true; RaisePropertyChanged("Rating"); }
}
[Browsable(false)]
public bool IsDirty { get; set; }
private dynamic _dynamics = new ExpandoObject();
[Browsable(false)]
public dynamic Dynamics
{
get { return _dynamics; }
set { _dynamics = value; RaisePropertyChanged("Dynamics"); }
}
#endregion
#region -----------------internal and calculated-----------------
[Browsable(true)]
[Description("File name")]
public string FileName
{
get { return Path.GetFileName(this._filePath); }
}
[Browsable(true)]
[Description("Folder")]
public string Folder
{
get { return Path.GetDirectoryName(this._filePath); }
}
[Browsable(true)]
[Description("File extension")]
public string FileExtension
{
get { return Path.GetExtension(this._filePath); }
}
private BookType _Type = BookType.None;
[Browsable(true)]
[Description("Type of")]
public BookType Type
{
get
{
if (_Type == BookType.None)
_Type = FileService.Instance.FindBookFilterByExt(FileExtension).Type;
return _Type;
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
WPF and MVVM fan, I practice C # in all its forms from the beginning of the NET Framework without mentioning C ++ / MFC and other software packages such as databases, ASP, WCF, Web & Windows services, Application, and now Core and UWP.
In my wasted hours, I am guilty of having fathered C.B.R. and its cousins C.B.R. for WinRT and UWP on the Windows store.
But apart from that, I am a great handyman ... the house, a rocket stove to heat the jacuzzi and the last one: a wood oven for pizza, bread, and everything that goes inside
https://guillaumewaser.wordpress.com/
https://fouretcompagnie.wordpress.com/