Ejemplo n.º 1
0
 public ReferenceList GetReferenceList()
 {
     ReferenceList referenceList = new ReferenceList();
     foreach (ReferenceItemWrapper item in SelectedVersesCheckedListBox.Items)
     {
         referenceList.AddReferenceItem(item.Item);
     }
     return referenceList;
 }
Ejemplo n.º 2
0
 public void AppendReferenceList(ReferenceList oldList)
 {
     if (oldList != null)
     {
         foreach (ReferenceItem item in oldList.Items)
         {
             _referenceList.Add(item);
         }
     }
 }
Ejemplo n.º 3
0
 public PresenterFolder.ReferenceList searchPhrase(string phrase)
 {
     List<data_index.Verse> verses = Bible.Index.GetVerses(phrase);
     PresenterFolder.ReferenceList newList = new PresenterFolder.ReferenceList();
     if (verses != null)
     {
         foreach (data_index.Verse item in verses)
         {
             newList.AddReference(item.Book, item.Chapter, item.VerseNumber);
         }
     }
     else
     {
         newList = null;
     }
     return newList;
 }
Ejemplo n.º 4
0
        public void DisplayVersesToWebView(ReferenceList list, string boldWords)
        {
            // save verses in cas a refresh is needed later
            _currentItemsInWebview = list.Items.ToArray();
            _currentBoldWord = boldWords;

            list.CompleteReferences(_backend);

            string finalPage="<ul>";
            string title="";
            string verses="";
            string tempVerse = "";

            int limit = 20;
            ReferenceItem item;
            for (int i = 0; i < list.Items.Count() && i < limit; i++)
            {
                item = list.Items[i];

                title = "";
                verses = "";

                title += item.StartBook + " " + item.StartChapter + ":" + item.StartVerse;

                if (item.Range == false) // get verse for single reference
                {
                    tempVerse = _backend.GetVerse(item.StartBook, (int)item.StartChapter, (int)item.StartVerse);
                    foreach (string word in boldWords.Split(' '))
                    {
                        tempVerse = Regex.Replace(tempVerse, (word + @"\b"), // @"\b" forces whole case
                            ("<b>" + word + "</b>"), RegexOptions.IgnoreCase);
                    }
                    verses +="</br>"+tempVerse;
                }
                else // the range of verses
                {
                    // add title
                    title += " - " + item.EndBook + " " + item.EndChapter + ":" + item.EndVerse;

                    string currentBook = "";
                    int currentChapter = 0;
                    foreach (data_index.Verse verseItem in _backend.GetVerseRange(
                        item.StartBook + " " + item.StartChapter + ":" + item.StartVerse,
                        item.EndBook + " " + item.EndChapter + ":" + item.EndVerse))
                    {
                        if (verseItem.Book != currentBook)
                        {
                            verses += "</br></br><b><h1>" + verseItem.Book + "</h1>"
                                + "Chapter " + verseItem.Chapter + "</b>";
                            currentBook = verseItem.Book;
                            currentChapter = (int)verseItem.Chapter;
                        }
                        else if (verseItem.Chapter != currentChapter)
                        {
                            verses += "</br></br><b>Chapter " + verseItem.Chapter + "</b>";
                            currentChapter = (int)verseItem.Chapter;
                        }
                        // print the verse itself
                        verses += "</br><b>" + verseItem.VerseNumber + "</b> "
                            + verseItem.GetVerseText();
                    }

                }

                // write html list item
                finalPage += "<li><b><p>" + title;
                if(!_view.verseListContains(item.ToString())) // look to see if add reference button needed
                {
                    finalPage += "<A HREF=\"HTML\\page.html:addReference="+i+"\"> Add</A>";
                }
                else
                {finalPage += " Added";}
                finalPage += "</b>" + verses + "</p></li>";
            }

            finalPage += "</ul>"; // put html end of list

            if (list.Items.Count() > limit)
            {
                finalPage += "<b>Plus " + (list.Items.Count() - limit) + " more</b>";
            }

            WriteWebView(finalPage);
        }
Ejemplo n.º 5
0
        private string[] verseListToTextForTTS(ReferenceList list)
        {
            string[] verseText = new string[list.Items.Count];
            string tempVerse = "";
            string tempTitle = "";
            list.CompleteReferences(_backend);
            int counter = 0;
            int verseNumber;
            foreach (ReferenceItem refItem in list.Items)
            {
                tempTitle = refItem.StartBook + " Chapter " + refItem.StartChapter + " verse " +
                    refItem.StartVerse;
                if (refItem.Range == false) // just one verse
                {
                    tempVerse = _backend.GetVerse(refItem.StartBook,
                        (int)refItem.StartChapter, (int)refItem.StartVerse);
                }
                else // range of verses in one refItem
                {
                    tempTitle += "; To " + refItem.EndBook + " Chapter " + refItem.EndChapter + " Verse " +
                        refItem.EndVerse;
                    tempVerse = "";//clear it just in case

                    // get range of verses and format the sting
                    foreach (data_index.Verse verseItem in _backend.GetVerseRange(
                        refItem.StartBook + " " + refItem.StartChapter + ":" +
                        refItem.StartVerse, refItem.EndBook + " " + refItem.EndChapter +
                        ":" + refItem.EndVerse))
                    {
                        verseNumber = verseItem.VerseNumber;
                        if (verseNumber == 1) // at first verse print book and chapter num
                        {
                            tempVerse += ". Chapter " + verseItem.Chapter + " of the book of " + verseItem.Book +". .";
                        }
                        tempVerse += ". " + verseItem.GetVerseText();   // apend that verses text
                    }// end foreach
                }

                verseText[counter] = tempTitle + '\n' + tempVerse;
                counter++;
            }
            return verseText;
        }
Ejemplo n.º 6
0
 public void setNewVerseList(ReferenceList list)
 {
     _view.ClearReferences();
     foreach (ReferenceItem item in list.Items)
     {
         addToVerseList(item);
     }
 }
Ejemplo n.º 7
0
 public void saveVerseListToFile(ReferenceList list, string fileName)
 {
     ObjectSerializing.SerializeObjectToFile(fileName, list);
 }
Ejemplo n.º 8
0
 public string putVersesToStringForTTS(ReferenceList list)
 {
     return putVersesToStringGeneric(verseListToTextForTTS(list));
 }
Ejemplo n.º 9
0
 public void putVersesToClipBoard(ReferenceList list)
 {
     Clipboard.SetText(putVersesToStringGeneric(verseListToText(list)));
 }
Ejemplo n.º 10
0
 public string putVersesForPlainText(ReferenceList list)
 {
     return putVersesToStringGeneric(verseListToText(list));
 }
Ejemplo n.º 11
0
 public void DisplayVersesToWebView(ReferenceList list, string boldWords)
 {
 }
Ejemplo n.º 12
0
        private void foundWholeBookName(ref string lastFoundBook, ref string[] text, 
            ref int i, ref List<string> suggestionList,  ref IMainWindow _view,
            ref string originalSearch, ref ReferenceList refList)
        {
            lastFoundBook = text[i].CapitalizeWord();
            if (i < text.Count() - 1) //something after book
            {

            }
            else // nothing after book
            {
                // return a list of possible chapters for the book
                suggestionList = _index.GetPossibleChapters(lastFoundBook).AddPrefixToList(originalSearch + " ");
                _view.SearchBoxSuggestions(suggestionList, originalSearch);
            }

            // save book reference
            if (refList.CurrentReference == null || refList.CurrentReference.Range == false)
            {
                refList.AddReference(lastFoundBook);
            }
            else // if expecting another book reference
            {
                refList.CurrentReference.EndBook = lastFoundBook;
                refList.AddReference(null);
            }

            //foundBook(text, originalSearch);
        }