private async void GetStats()
 {
     IsCreatingIndexesMessageVisible = true;
     AreDatabaseStatsVisible = false;
     DatabaseStats databaseStats;
     try
     {
         databaseStats = await MainModel.GetDatabaseStatsAsync();
     }
     catch (Exception exception)
     {
         ShowErrorWindow(exception, CurrentWindowContext);
         CurrentWindowContext.CloseDialog(false);
         return;
     }
     DatabaseFilePath = MainModel.GetDatabaseFullPath(MainModel.AppSettings.DatabaseFileName);
     NonFictionTotalBooks = formatter.ToFormattedString(databaseStats.NonFictionBookCount);
     NonFictionLastUpdate = databaseStats.NonFictionLastUpdate.HasValue ?
         formatter.ToFormattedDateTimeString(databaseStats.NonFictionLastUpdate.Value) : Localization.Never;
     FictionTotalBooks = formatter.ToFormattedString(databaseStats.FictionBookCount);
     FictionLastUpdate = databaseStats.FictionLastUpdate.HasValue ? formatter.ToFormattedDateTimeString(databaseStats.FictionLastUpdate.Value) :
         Localization.Never;
     SciMagTotalArticles = formatter.ToFormattedString(databaseStats.SciMagArticleCount);
     SciMagLastUpdate = databaseStats.SciMagLastUpdate.HasValue ? formatter.ToFormattedDateTimeString(databaseStats.SciMagLastUpdate.Value) :
         Localization.Never;
     IsCreatingIndexesMessageVisible = false;
     AreDatabaseStatsVisible = true;
 }
        private async void GetStats()
        {
            isDatabaseOperationInProgress = true;
            AreDatabaseStatsVisible       = false;
            DatabaseStats databaseStats;

            try
            {
                bool databaseStatsIndexesCreated = await MainModel.CheckIfDatabaseStatsIndexesCreated();

                if (!databaseStatsIndexesCreated)
                {
                    if (!ShowPrompt(Localization.IndexesRequiredTitle, Localization.IndexesRequiredText))
                    {
                        isDatabaseOperationInProgress = false;
                        CurrentWindowContext.CloseDialog(false);
                        return;
                    }
                }
                IsCreatingIndexesMessageVisible = true;
                databaseStats = await MainModel.GetDatabaseStatsAsync();
            }
            catch (Exception exception)
            {
                ShowErrorWindow(exception, CurrentWindowContext);
                isDatabaseOperationInProgress = false;
                CurrentWindowContext.CloseDialog(false);
                return;
            }
            DatabaseFilePath     = MainModel.GetDatabaseFullPath(MainModel.AppSettings.DatabaseFileName);
            NonFictionTotalBooks = formatter.ToFormattedString(databaseStats.NonFictionBookCount);
            NonFictionLastUpdate = databaseStats.NonFictionLastUpdate.HasValue ?
                                   formatter.ToFormattedDateTimeString(databaseStats.NonFictionLastUpdate.Value) : Localization.Never;
            FictionTotalBooks = formatter.ToFormattedString(databaseStats.FictionBookCount);
            FictionLastUpdate = databaseStats.FictionLastUpdate.HasValue ? formatter.ToFormattedDateTimeString(databaseStats.FictionLastUpdate.Value) :
                                Localization.Never;
            SciMagTotalArticles = formatter.ToFormattedString(databaseStats.SciMagArticleCount);
            SciMagLastUpdate    = databaseStats.SciMagLastUpdate.HasValue ? formatter.ToFormattedDateTimeString(databaseStats.SciMagLastUpdate.Value) :
                                  Localization.Never;
            IsCreatingIndexesMessageVisible = false;
            AreDatabaseStatsVisible         = true;
            isDatabaseOperationInProgress   = false;
        }