Exemple #1
0
        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");
        }