public void View(string path, ContextObject context) { _epubControl = new EpubViewerControl(context); context.ViewerContent = _epubControl; Exception exception = null; _epubControl.Dispatcher.BeginInvoke(new Action(() => { try { // Opens a book var epubBook = EpubReader.OpenBook(path); context.Title = epubBook.Title; _epubControl.SetContent(epubBook); context.IsBusy = false; } catch (Exception e) { exception = e; } }), DispatcherPriority.Loaded).Wait(); if (exception != null) { ExceptionDispatchInfo.Capture(exception).Throw(); } }
public void Cleanup() { _epubControl.Dispose(); _epubControl = null; }