コード例 #1
0
        public MTPatchModel(string sAdress, DateTime dtCreated, string sGUID, bool bTestIsEnabled)
        {
            SetLstAdress(MTControler.GetListMap(sAdress));

            _lstTest        = new List <MTStructTest>();
            _dtCreated      = dtCreated;
            _dScore         = 0;
            _dPosition      = 0;
            _sGUID          = sGUID;
            _bTestIsEnabled = bTestIsEnabled;
            _mgrApply       = new MTApplyMgrModel(this);
        }
コード例 #2
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);
        }