public TranslationViewModel(int bookId)
 {
     selectChapterCommand = null;
     selectedChapter = null;
     selectedChapterContent = null;
     LoadBook(bookId);
 }
Пример #2
0
 public LibraryViewModel()
 {
     windowManager = WindowManager.Instance;
     libraryModel = new LibraryModel();
     addBookCommand = null;
     removeFromLibraryCommand = null;
     openBookCommand = null;
     RefreshLibrary();
 }
Пример #3
0
 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());
 }
Пример #4
0
        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());
        }