private void btnGoToPrevious_Click(object sender, EventArgs e) { comReader.PreviousPage(); picBxComicScreen.Image.Dispose(); picBxComicScreen.Image = comReader.GetCurrentPage(); lblPageNumber.Text = "Page " + comReader.GetCurrentPageNumber() + " of " + comReader.GetPageCount().ToString(); PageChanged(); }
public int GetPageCount() { if (IsReadingComic) { return(comicReader.GetPageCount()); } else { throw new NoComicOpenedException("User has not yet opened a comic book."); } }
private void ComicView_Load(object sender, EventArgs e) { comReader = new ComicReader(); //start of background thread stuff progDialog = new ProgressDialog(); backgroundProcessDone = false; bgWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; comReader.ReportProgress += ComicReader_ReportProgress; bgWorker.DoWork += delegate(object s, DoWorkEventArgs args) { comReader.OpenComicBook(comicPath); }; bgWorker.RunWorkerAsync(); progDialog.ShowDialog(); //end of background thread stuff //wait for comic book to load while (!backgroundProcessDone) { ; } picBxComicScreen.SizeMode = PictureBoxSizeMode.Zoom; panelComicScreen.AutoScroll = true; picBxComicScreen.Image = comReader.GetCurrentPage(); lblPageNumber.Text = "Page 1 of " + comReader.GetPageCount().ToString(); }