/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { IsolatedStorageHelper.ClearStorageZipDirectory(); DatabaseService.Deactivate(); } _disposed = true; } }
private void LoadBookAsync() { // create new book Book = new Book(); Book.ReaderVersion = Globals.Version; #if DEBUG Book.Files = ZipHelper.Extract(Source); #else try { Book.Files = ZipHelper.Extract(newValue); } catch (Exception ex) { OnDocumentFailed(ex); return; } #endif // load book if (_loader == null) { _loader = new Loader(this); } #if DEBUG _loader.Load(); #else try { _loader.Load(); } catch (Exception ex) { OnDocumentFailed(ex); return; } #endif // we have to load book before we gonna try to get it from cache // we can need files and we need Identifier TryGetBookFromCache(); // check book has cover HasCover = CheckHasCover(); if (!HasCover) { _coverBitmapImage = null; } // check book has ToC HasToc = Book.Toc != null; if (_tocListBox != null) { BindToc(); } // parse if (_parser == null) { _parser = new Parser(this); } #if DEBUG _parser.Parse(); #else try { _parser.Parse(); } catch (Exception ex) { OnDocumentFailed(ex); return; } #endif // update furthest location FurthestLocation = Book.ItemElementsContainers.Last().EndLocation; // clear storage IsolatedStorageHelper.ClearStorageZipDirectory(); Render(); OnDocumentOpened(); }