private void BookOpened(Task <EpubBook> task) { EpubBook epubBook = task.Result; Contents = new ObservableCollection <ChapterViewModel>(bookModel.GetChapters(epubBook)); images = epubBook.Content.Images.ToDictionary(imageFile => imageFile.Key, imageFile => imageFile.Value.Content); styleSheets = epubBook.Content.Css.ToDictionary(cssFile => cssFile.Key, cssFile => cssFile.Value.Content); fonts = epubBook.Content.Fonts.ToDictionary(fontFile => fontFile.Key, fontFile => fontFile.Value.Content); if (Contents.Any()) { SelectChapter(Contents.First()); } IsLoading = false; }
private void LoadBook(int bookId) { bookModel = new BookModel(); epubBook = bookModel.OpenBook(bookId); epubBook1 = bookModel.OpenBook(bookId + 1); epubBook2 = bookModel.OpenBook(bookId + 2); Contents = new ObservableCollection <ChapterViewModel>(bookModel.GetChapters(epubBook, epubBook1, epubBook2)); images = epubBook.Content.Images.ToDictionary(imageFile => imageFile.Key, imageFile => imageFile.Value.Content); styleSheets = epubBook.Content.Css.ToDictionary(cssFile => cssFile.Key, cssFile => cssFile.Value.Content); fonts = epubBook.Content.Fonts.ToDictionary(fontFile => fontFile.Key, fontFile => fontFile.Value.Content); if (Contents.Any()) { SelectChapter(Contents.First()); } }
public BookViewModel(int bookId) { bookModel = new BookModel(); epubBook = bookModel.OpenBook(bookId); Contents = new ObservableCollection <ChapterViewModel>(bookModel.GetChapters(epubBook)); images = epubBook.Content.Images.ToDictionary(imageFile => imageFile.Key, imageFile => imageFile.Value.Content); styleSheets = epubBook.Content.Css.ToDictionary(cssFile => cssFile.Key, cssFile => cssFile.Value.Content); fonts = epubBook.Content.Fonts.ToDictionary(fontFile => fontFile.Key, fontFile => fontFile.Value.Content); selectChapterCommand = null; selectedChapter = null; selectedChapterContent = null; if (Contents.Any()) { SelectChapter(Contents.First()); } }
public void LoadBook(int bookId, bool append = false) { var epubBook = bookModel.OpenBook(bookId); Contents = Contents.AddRange(bookModel.GetChapters(epubBook)); images = images.AddRange(epubBook.Content.Images.ToDictionary(imageFile => imageFile.Key, imageFile => imageFile.Value.Content)); styleSheets = styleSheets.AddRange(epubBook.Content.Css.ToDictionary(cssFile => cssFile.Key, cssFile => cssFile.Value.Content)); fonts = fonts.AddRange(epubBook.Content.Fonts.ToDictionary(fontFile => fontFile.Key, fontFile => fontFile.Value.Content)); selectChapterCommand = null; selectedChapter = null; selectedChapterContent = null; if (Contents.Any()) { SelectChapter(Contents.First()); } }