コード例 #1
0
ファイル: BookViewModel.cs プロジェクト: gareiz/EpubReader
 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());
 }
コード例 #2
0
 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());
 }