Пример #1
0
        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 { }
        }
Пример #2
0
        public SplashVM(ComicFileVM file)
        {
            this.CurrentFile = file;
            this.Store       = DependencyService.Get <ComicsShelf.Store.ILibraryStore>();
            this.Library     = this.Store.GetLibrary(file.ComicFile.LibraryKey);

            this.FolderFiles = this.Store.LibraryFiles[ComicsShelf.Store.enLibraryFilesGroup.Libraries]
                               .Where(x =>
                                      x.ComicFile.LibraryKey == file.ComicFile.LibraryKey &&
                                      x.ComicFile.FolderPath == file.ComicFile.FolderPath &&
                                      x.ComicFile.Available == true)
                               .OrderByDescending(x => x.ComicFile.FilePath)
                               .ToList();

            this.ItemSelectedCommand = new Command(async(item) => await this.ItemSelected(item));
            this.ItemOpenCommand     = new Command(async() => await this.ItemOpen());
            this.ClearCacheCommand   = new Command(async() => await this.ClearCache());
        }