Exemplo n.º 1
0
 public void SetSelectedVersesList()
 {
     SelectedPatch.Clear();
     foreach (object obj in lvMap.SelectedItems)
     {
         MTMapModel objMap = obj as MTMapModel;
         SelectedPatch.Add(objMap);
     }
 }
Exemplo n.º 2
0
        //################# Ask Text #####################
        private void tbSearch_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (tbSearch.Text.Length > 3)
            {
                _dicSearch.Clear();
                foreach (MTPatchModel objPatch in MTControler.TextManager.LstPatch)
                {
                    string sText = objPatch.Text;

                    sText = sText.Replace("[", "");
                    sText = sText.Replace("]", "");
                    sText = sText.Replace("'", "");
                    sText = sText.Replace("\"", "");
                    sText = sText.Replace(" ", "");

                    if (sText.ToLower().Contains(tbSearch.Text.ToLower()))
                    {
                        _dicSearch.Add(objPatch, sText);
                    }
                }
                if (_dicSearch.Count > 0)
                {
                    lbNumb.Content       = "1";
                    lbSearchDesc.Content = _dicSearch.Count.ToString() + " textos encontrados";
                    SelectedPatch        = _dicSearch.First().Key.LstAdress;
                }
                else
                {
                    lbNumb.Content       = "0";
                    lbSearchDesc.Content = "Nenhum texto encontrado";
                    SelectedPatch.Clear();
                }
            }
            else
            {
                SelectedPatch.Clear();
            }
            Action(this);
        }
Exemplo n.º 3
0
        //################# Ask Adrees by Text #####################

        private void tbTextAdres_TextChanged(object sender, TextChangedEventArgs e)
        {
            string sText = tbTextAdres.Text.ToLower();

            sText = sText.Trim();

            if (sText == "")
            {
                tblockTextAdres.Text = "";
                SelectedPatch.Clear();
                return;
            }
            string sFirstchar = sText.Substring(0, 1);

            sText = sText.Substring(1);
            char[] arr = sText.ToCharArray();

            arr   = Array.FindAll <char>(arr, (c => (char.IsLetter(c) || char.IsWhiteSpace(c))));
            sText = new string(arr);

            sText = sFirstchar + sText;
            sText = sText.Trim();

            if (sText == "")
            {
                tblockTextAdres.Text = "";
                Action(this);
                return;
            }

            MTBookModel objSelBook = null;

            foreach (MTBookModel objBook in MTControler.Library.LstBooks)
            {
                string sBookAbrev = objBook.Abbrev.ToLower();
                if (sText.Length <= sBookAbrev.Length)
                {
                    if (sText.StartsWith(sBookAbrev.Substring(0, sText.Length)))
                    {
                        objSelBook = objBook;
                    }
                }

                string sBookFull = objBook.Name.ToLower();
                if (sText.Length <= sBookFull.Length)
                {
                    if (sText.StartsWith(sBookFull.Substring(0, sText.Length)))
                    {
                        objSelBook = objBook;
                    }
                }
            }
            if (objSelBook == null)
            {
                tblockTextAdres.Text = "Texto Inválido!";
                SelectedPatch.Clear();
                Action(this);
                return;
            }
            string sChapterVerses = tbTextAdres.Text.ToLower().Replace(sText, "");

            sChapterVerses       = sChapterVerses.Replace(" ", "");
            tblockTextAdres.Text = objSelBook.Name + " " + sChapterVerses;

            List <MTMapModel> lstMap = MTControler.GetListMap(objSelBook.Abbrev + " " + sChapterVerses);

            if (lstMap != null)
            {
                SelectedPatch = lstMap;
            }
            else
            {
                SelectedPatch.Clear();
            }

            Action(this);
        }