public LibraryService(Store.LibraryModel Library) { try { this.Library = Library; this.Notify = new Notify.NotifyVM("General"); this.Store = DependencyService.Get <Store.ILibraryStore>(); if (!this.Store.LibraryFiles.ContainsKey(ComicsShelf.Store.enLibraryFilesGroup.Libraries)) { this.Store.LibraryFiles.Add(ComicsShelf.Store.enLibraryFilesGroup.Libraries, new List <ComicFiles.ComicFileVM>()); } if (!this.Store.LibraryFiles.ContainsKey(ComicsShelf.Store.enLibraryFilesGroup.RecentFiles)) { this.Store.LibraryFiles.Add(ComicsShelf.Store.enLibraryFilesGroup.RecentFiles, new List <ComicFiles.ComicFileVM>()); } if (!this.Store.LibraryFiles.ContainsKey(ComicsShelf.Store.enLibraryFilesGroup.ReadingFiles)) { this.Store.LibraryFiles.Add(ComicsShelf.Store.enLibraryFilesGroup.ReadingFiles, new List <ComicFiles.ComicFileVM>()); } if (!System.IO.Directory.Exists(Helpers.Constants.CoversCachePath)) { System.IO.Directory.CreateDirectory(Helpers.Constants.CoversCachePath); } if (!System.IO.Directory.Exists(Helpers.Constants.FilesCachePath)) { System.IO.Directory.CreateDirectory(Helpers.Constants.FilesCachePath); } } catch { } }
public LibraryVM(Store.LibraryModel library) { this.Library = library; this.Title = library.Description; this.Notify = new Notify.NotifyVM(library.ID); this.ComicFolders = new ObservableList <ComicFolderVM>(); this.OpenCommand = new Command(async(item) => await this.Open(item as ComicFileVM)); this.RemoveCommand = new Command(async() => await this.Remove()); this.OnRefreshingList(DependencyService.Get <Store.ILibraryStore>().GetLibraryFiles(this.Library)); Messaging.Subscribe <List <ComicFileVM> >("OnRefreshingList", this.Library.ID, this.OnRefreshingList); Messaging.Subscribe <ComicFileVM>("OnRefreshingItem", this.Library.ID, this.OnRefreshingItem); }
public FeaturedVM() { this.Title = R.Strings.HOME_MAIN_TITLE; this.Notify = new Notify.NotifyVM("General"); this.ComicFolders = new ObservableList <ComicFolderVM>(); this.ComicFolders.Add(new ComicFolderVM { FolderPath = R.Strings.HOME_READING_FILES_SECTION_TITLE }); this.ComicFolders.Add(new ComicFolderVM { FolderPath = R.Strings.HOME_RECENT_FILES_SECTION_TITLE }); this.OpenCommand = new Command(async(item) => await this.Open(item as ComicFileVM)); Messaging.Subscribe <List <ComicFileVM> >("OnRefreshingReadingFilesList", this.OnRefreshingReadingFilesList); Messaging.Subscribe <List <ComicFileVM> >("OnRefreshingRecentFilesList", this.OnRefreshingRecentFilesList); }