private async void OnCreateDatabase(object sender, RoutedEventArgs e) { BookDataContext.ResetSingleton("InitialBookData.Db"); var bookdb = BookDataContext.Get(); CommonQueries.BookDoMigrate(bookdb); // might not exist at all; Migrate is the way to force creation of tables. var iftg = new InitializeFilesToGet(); await iftg.CreateDatabaseAsync(bookdb); BookDataContext.ResetSingleton(null); // reset database }
private async void MainPage_Loaded(object sender, RoutedEventArgs e) { Logger.Log("MainPage:Loaded:called"); var bookdb = BookDataContext.Get(); Logger.Log("MainPage:Loaded:about to migrate"); CommonQueries.BookDoMigrate(bookdb); Logger.Log("MainPage:Loaded:done migration"); // Reset to the tab the user had originally picked. SelectUserTab(); var(id, _) = MainEpubReader.GetCurrReadingBook(); // _ is pos if (App.SavedActivatedBookData != null) { var nav = Navigator.Get(); nav.DisplayBook(Navigator.NavigateControlId.InitializationCode, App.SavedActivatedBookData, App.SavedActivatedBookLocation); } else if (id != null) { var book = CommonQueries.BookGet(bookdb, id); if (book != null) { var nav = Navigator.Get(); nav.DisplayBook(Navigator.NavigateControlId.InitializationCode, book); } } if (WarmUpDataBase == null) { WarmUpDataBase = CommonQueries.FirstSearchToWarmUpDatabase(); } #if DEBUG // There are only shown in debug mode! uiLogTab.Visibility = Visibility.Visible; uiDebugMenu.Visibility = Visibility.Visible; #endif await BookMarkFile.SmartReadAsync(); Logger.Log("MainPage:Loaded:returning"); }