Пример #1
0
 public BookView()
 {
     InitializeComponent();
     View = this;
     ShowWatermark = true;
     txtSearch.GotFocus += TxtSearch_GotFocus;
     txtSearch.LostFocus += TxtSearch_LostFocus;
     bookModel = new BookModel();
 }
Пример #2
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());
 }
Пример #3
0
 private async Task Search()
 {
     SearchResults = new List<SearchResult>();
     LibraryView vm = new LibraryView();
     foreach (var book in vm.Books)
     {
         var bk = new BookModel().OpenBook(book.Id);
         foreach (var chapter in bk.Chapters)
         {
             SearchInChapter(chapter);
         }
     }
     lstResults.ItemsSource = SearchResults;
 }
Пример #4
0
 public BookViewModel()
 {
     bookModel = new BookModel();
 }
 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());
 }