public void ResetStorehouse() { JwStore database = new JwStore(Storehouse.Primary); database.Open(); database.DeleteAllTables(); database.Close(); database = new JwStore(Storehouse.Secondary); database.Open(); database.DeleteAllTables(); database.Close(); PrimaryBibleBooks = null; SecondaryBibleBooks = null; PrimaryInsightGroups = null; SecondaryInsightGroups = null; PrimaryInsightArticles = null; SecondaryInsightArticles = null; PrimaryBooks = null; SecondaryBooks = null; PrimaryWebViewStack = null; SecondaryWebViewStack = null; SelectedArticle = new NavStruct(); Libraries = null; CurrentLibrary = Library.None; CurrentScreenMode = ScreenMode.Duel; Swapped = false; ArticleNavigation = new Dictionary <string, NavStruct>(); App.STATE.PrimaryLanguage = null; App.STATE.SecondaryLanguage = null; App.STATE.Language = ""; // Clear all preferences var prefs = PreferenceManager.GetDefaultSharedPreferences(Context); prefs.Edit().Clear().Commit(); }
private string GetArticleFromStorehouse(string storehouse) { Library library = App.STATE.CurrentLibrary; WOLArticle article = new WOLArticle(); string title = string.Empty; string html = string.Empty; JwStore database = new JwStore(storehouse); database.Open(); ////////////////////////////////////////////////////////////////////////// // TRY TO GET ARTICLE, IF NOT, DISPLAY NOTHING ////////////////////////////////////////////////////////////////////////// //try //{ ////////////////////////////////////////////////////////////////////////// // BIBLE ////////////////////////////////////////////////////////////////////////// if (library == Library.Bible) { article = database.QueryBible(SelectedArticle).ToArticle(); title = article.ArticleTitle.Replace("\n", "<br/>"); if (storehouse == Storehouse.Primary) { primaryArticles = database.QueryAllArticlesByBibleChapter(title.Split('<')[0]).ToArticleList(); foreach (var a in primaryArticles) { primaryChapters.Add(Html.FromHtml(a.ArticleLocation)); } } else if (storehouse == Storehouse.Secondary) { secondaryArticles = database.QueryAllArticlesByBibleChapter(title.Split('<')[0]).ToArticleList(); foreach (var a in secondaryArticles) { secondaryChapters.Add(Html.FromHtml(a.ArticleLocation)); } } } ////////////////////////////////////////////////////////////////////////// // DAILY TEXT ////////////////////////////////////////////////////////////////////////// else if (library == Library.DailyText) { article = database.QueryDailyText(SelectedArticle.ToString()).ToArticle(); if (storehouse == Storehouse.Primary) { primaryArticles = database.QueryArticles(article.PublicationCode).ToArticleList(); foreach (var a in primaryArticles) { primaryChapters.Add(Html.FromHtml(a.ArticleTitle)); } } else if (storehouse == Storehouse.Secondary) { secondaryArticles = database.QueryArticles(article.PublicationCode).ToArticleList(); foreach (var a in secondaryArticles) { secondaryChapters.Add(Html.FromHtml(a.ArticleTitle)); } } title = article.PublicationName.Replace("\n", "<br/>"); } ////////////////////////////////////////////////////////////////////////// // INSIGHT VOLUMES ////////////////////////////////////////////////////////////////////////// else if (library == Library.Insight) { article = database.QueryInsight(SelectedArticle).ToArticle(); if (storehouse == Storehouse.Primary) { //primaryArticles = database.QueryArticles("it").ToArticleList(); primaryArticles = database.QueryMatchingArticles(insightMEPS.ToList()).ToArticleList(); foreach (var a in primaryArticles) { primaryChapters.Add(Html.FromHtml(a.ArticleTitle + "<br/><i>" + a.ArticleLocation + "</i>")); } } else if (storehouse == Storehouse.Secondary) { //secondaryArticles = database.QueryArticles("it").ToArticleList(); secondaryArticles = database.QueryMatchingArticles(insightMEPS.ToList()).ToArticleList(); foreach (var a in secondaryArticles) { secondaryChapters.Add(Html.FromHtml(a.ArticleTitle + "<br/><i>" + a.ArticleLocation + "</i>")); } } title = article.PublicationName.Replace("\n", "<br/>"); } ////////////////////////////////////////////////////////////////////////// // BOOKS & PUBLICATIONS ////////////////////////////////////////////////////////////////////////// else if (library == Library.Books) { article = database.QueryPublication(SelectedArticle).ToArticle(); if (storehouse == Storehouse.Primary) { primaryArticles = database.QueryArticles(article.PublicationCode).ToArticleList(); foreach (var a in primaryArticles) { primaryChapters.Add(Html.FromHtml(a.ArticleTitle + "<br/><i>" + a.ArticleLocation + "</i>")); } } else if (storehouse == Storehouse.Secondary) { secondaryArticles = database.QueryArticles(article.PublicationCode).ToArticleList(); foreach (var a in secondaryArticles) { secondaryChapters.Add(Html.FromHtml(a.ArticleTitle + "<br/><i>" + a.ArticleLocation + "</i>")); } } title = article.PublicationName.Replace("\n", "<br/>"); } ////////////////////////////////////////////////////////////////////////// // ALL OTHER ////////////////////////////////////////////////////////////////////////// else { if (storehouse == Storehouse.Primary) { } else if (storehouse == Storehouse.Secondary) { } } //} //catch(Exception e) //{ // Console.WriteLine(e.Message); //} // Close database database.Close(); // Set Publication title if (storehouse == ((App.STATE.Swapped == false) ? Storehouse.Primary : Storehouse.Secondary)) { text.SetText(Html.FromHtml("<center>" + App.FUNCTIONS.RemoveDigits(title) + "</center>"), TextView.BufferType.Normal); } // Set Article content html if (library == Library.Bible) { html = "<center><h3>" + title + "</h3></center>" + article.ArticleContent; } else { html = article.ArticleContent; } return(html); }