예제 #1
0
        public void UpdateDisplay()
        {
            double dUnansuered   = 0;
            double dRight        = 0;
            double dWrong        = 0;
            double dPointsGave   = 0;
            double dPointsLossed = 0;

            foreach (MTTestModel objTest in _lstTests)
            {
                if (objTest.WasCorrect == null)
                {
                    dUnansuered++;
                }
                else if (objTest.WasCorrect == true)
                {
                    dRight++;
                    dPointsGave += MTControler.LastPoints(objTest.Patch);
                }
                else
                {
                    dWrong++;
                    dPointsLossed += MTControler.LastPoints(objTest.Patch);
                }
            }

            lbUnansuered.Content   = dUnansuered.ToString();
            lbRight.Content        = dRight.ToString();
            lbWrong.Content        = dWrong.ToString();
            lbPointsGave.Content   = dPointsGave.ToString();
            lbPointsLossed.Content = dPointsLossed.ToString();
        }
예제 #2
0
        public virtual void SetAnsuer()
        {
            string s_Ansuer   = MTControler.GetAdrees(_LstAnsuer, false);
            string s_Response = _objPatch.Adrees;

            _dtDate = DateTime.Now;
            MTStructTest strTest;

            strTest.Date = this.Date;
            strTest.Type = this.Type;

            if (s_Ansuer == s_Response)
            {
                WasCorrect         = true;
                strTest.WasCorrect = true;
                _objPatch.lstTest.Add(strTest);
                MTClassificator.UpdatePatch(_objPatch);
            }
            else
            {
                WasCorrect         = false;
                strTest.WasCorrect = false;
                _objPatch.lstTest.Add(strTest);
                MTClassificator.UpdateAllPositions();
            }
            MTParser.WritePatch(_objPatch);
            MTParser.WriteDataTest(_objPatch, this);
        }
예제 #3
0
        private void btAdd_Click(object sender, RoutedEventArgs e)
        {
            MTTestModel objTest = MTControler.GetNextTest(_lstTests);

            _lstTests.Add(objTest);
            InitializeTests(objTest);
            UpdateDisplay();
        }
예제 #4
0
 public MTMainView()
 {
     InitializeComponent();
     MainGrid.DataContext = MTControler.TextManager;
     _dtlimit             = new DateTime();
     lbCount.Content      = MTControler.GetWaitngList(false);
     InitializeTimer();
     lbPatchCount.Content = "Número de textos: " + MTControler.TextManager.LstPatch.Count().ToString();
 }
예제 #5
0
 private void Window_Unloaded(object sender, RoutedEventArgs e)
 {
     _lstTests.Clear();
     MTControler.MainView.lbCount.Content = MTControler.GetWaitngList(false);
     MTControler.DlgPositTest.GetPosition(this);
     GC.Collect();
     GC.WaitForPendingFinalizers();
     GC.Collect();
 }
예제 #6
0
        public void Action(MTMapUser ansuerUser)
        {
            tbText.Document.Blocks.Clear();
            Paragraph parag = MTControler.GetText(_Map.SelectedPatch, "$Verse$");

            if (parag != null)
            {
                tbText.Document.Blocks.Add(parag);
            }
        }
예제 #7
0
        public Paragraph GetCorrectAnsuer()
        {
            Paragraph parag    = MTControler.GetText(_objPatch.LstAdress, "$Verse$");
            Run       rCorrect = new Run("Texto correto: ");

            rCorrect.FontWeight = FontWeights.Bold;
            parag.Inlines.InsertBefore(parag.Inlines.FirstInline, rCorrect);
            parag.LineHeight = 3;
            return(parag);
        }
예제 #8
0
        public Paragraph GetParagAsk(string sSeparator)
        {
            Run rAsk = new Run("Que texto é esse?\n");

            rAsk.FontWeight = FontWeights.Bold;
            Paragraph parag = new Paragraph();

            parag = MTControler.GetText(_objPatch.LstAdress, sSeparator);
            parag.Inlines.InsertBefore(parag.Inlines.FirstInline, rAsk);
            return(parag);
        }
예제 #9
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);
        }
예제 #10
0
        public void RumNextTest()
        {
            MTParser.ReadNewBible(@"C:\Users\Vitor\OneDrive\Arsenal Technology\Projetos\Adestra\MaindText\bin\Release\Library\Mt\mat.xml");
            MTTestModel objTest = MTControler.GetNextTest(MTControler.LstTest);

            MTControler.AddTestInList(objTest);
            MTControler.DlgTest.InitializeTests(objTest);

            if (this.WindowState != WindowState.Minimized && MTControler.LstTest.Count == 1)
            {
                MTControler.ShowLstDlgTest();
            }
        }
예제 #11
0
        public override void Action(MTMapUser ansuerUser)
        {
            _LstAnsuer = ansuerUser.SelectedPatchClone;
            _sFragment = ansuerUser.tbSearch.Text;
            string sText = MTControler.GetAdrees(ansuerUser.SelectedPatch, false);

            AnsuerToShow = (sText == "" ? _sAnsuer : sText);
            ListView    lvTest   = MTControler.DlgTest.lbTest;
            RichTextBox objRtbox = UtilsTools.GetChild(lvTest, lvTest.Items.IndexOf(this), "rtbText") as RichTextBox;

            objRtbox.Document.Blocks.Clear();
            objRtbox.Document.Blocks.Add(GetParagAsk());
            objRtbox.Document.Blocks.Add(GetSearchedText());
        }
예제 #12
0
        public Paragraph GetWrongAnsuer()
        {
            if (_LstAnsuer == null || _LstAnsuer.Count == 0 || (_LstAnsuer.First() as MTVerseModel) == null)
            {
                return(new Paragraph());
            }

            Paragraph parag      = MTControler.GetText(_LstAnsuer, "$Verse$");
            Run       rIncorrect = new Run("Texto da sua resposta: ");

            rIncorrect.FontWeight = FontWeights.Bold;
            parag.Inlines.InsertBefore(parag.Inlines.FirstInline, rIncorrect);
            parag.LineHeight = 1;
            return(parag);
        }
예제 #13
0
        public Paragraph GetParagAsk()
        {
            Paragraph parag = new Paragraph();
            Run       rAsk  = new Run("O que está escrito em: ");
            Run       rText = new Run(Patch.Adrees);

            rText.FontWeight = FontWeights.Bold;
            parag.Inlines.Add(rAsk);
            parag.Inlines.Add(rText);
            if (Patch.Score < MTControler.Settings.Stg1to2 || WasCorrect != null)
            {
                parag.Inlines.Add(MTControler.GetTextsInChapter((_objPatch.LstAdress.First().Parent as MTChapterModel), _objPatch.LstAdress));
            }
            parag.LineHeight = 1;
            return(parag);
        }
예제 #14
0
 //this is the method that the deleagte will execute
 public void RunInLastThread(MTMainView objMainView)
 {
     if (MTControler.TimeRemaining == _dtlimit)
     {
         MTControler.TimeRemaining = new DateTime().AddMinutes(MTControler.Settings.AutoTestInterval);
         //Rum methode
         objMainView.RumNextTest();
         if (objMainView.WindowState == WindowState.Minimized)
         {
             MTControler.NiIcon.BalloonTipText = MTControler.GetWaitngList(true);
             MTControler.NiIcon.ShowBalloonTip(3000);
         }
     }
     else if (MTControler.Settings.AutoTestEnabled)
     {
         MTControler.TimeRemaining = MTControler.TimeRemaining.AddSeconds(-1);
         CultureInfo provider = new CultureInfo("pt-PT");
         objMainView.lbTimer.Content = "Próximo teste em " + MTControler.TimeRemaining.ToString("T", provider);
     }
 }
예제 #15
0
        private Paragraph GetSearchedText()
        {
            string sText = MTControler.GetStringText(_LstAnsuer);

            if (sText == null || _sFragment == null)
            {
                return(new Paragraph());
            }

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

            int iStart = sText.ToLower().IndexOf(_sFragment.ToLower());
            int iEnd   = iStart + _sFragment.Length;

            Run rStart = new Run(sText.Substring(0, iStart));
            Run rMid   = new Run(sText.Substring(iStart, iEnd - iStart));
            Run rEnd   = new Run(sText.Substring(iEnd));

            rMid.Background = new SolidColorBrush(Colors.Yellow);

            Paragraph paragText = new Paragraph();

            paragText.Inlines.Add(rStart);
            paragText.Inlines.Add(rMid);
            paragText.Inlines.Add(rEnd);
            paragText.LineHeight = 3;

            if (paragText != null)
            {
                return(paragText);
            }
            else
            {
                return(new Paragraph());
            }
        }
예제 #16
0
        public void RumSelectedTest()
        {
            if (lvTexts.Items.Count == 0)
            {
                return;
            }

            if (this.lvTexts.SelectedIndex > -1)
            {
                foreach (MTPatchModel objPatch in lvTexts.SelectedItems)
                {
                    MTTestModel objTest = objPatch.NextTest;
                    MTControler.LstTest.Add(objTest);
                    MTControler.DlgTest.InitializeTests(objTest);
                }
                MTControler.ShowLstDlgTest();
            }
            else
            {
                MessageBox.Show("Selecione pelomenos im item na lista.", "Selecione um item", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
예제 #17
0
        public void SetLstAdress(List <MTMapModel> lstAdres)
        {
            if (_LstAdress != null)
            {
                foreach (MTMapModel objMap in _LstAdress)
                {
                    objMap.RemoveOccurrence(1);
                }
            }

            _LstAdress    = lstAdres;
            _sText        = MTControler.GetStringText(_LstAdress);
            _sAdrees      = MTControler.GetAdrees(_LstAdress, false);
            _sShortAdrees = MTControler.GetAdrees(_LstAdress, true);
            FirePropertyChanged("Text");
            FirePropertyChanged("Adrees");
            FirePropertyChanged("AdreesAbrevied");
            foreach (MTMapModel objMap in _LstAdress)
            {
                objMap.AddOccurrence(1);
            }
        }
예제 #18
0
        private void SetNextPatch(bool bToFront)
        {
            bool bSet = false;

            if (bToFront)
            {
                for (int i = 0; i < _dicSearch.Count(); i++)
                {
                    if (bSet)
                    {
                        SelectedPatch  = _dicSearch.ElementAt(i).Key.LstAdress;
                        lbNumb.Content = (i + 1).ToString();
                        break;
                    }
                    if (MTControler.IsEqual(_dicSearch.ElementAt(i).Key.LstAdress, SelectedPatch))
                    {
                        bSet = true;
                    }
                }
            }
            else
            {
                for (int i = _dicSearch.Count() - 1; i >= 0; i--)
                {
                    if (bSet)
                    {
                        SelectedPatch  = _dicSearch.ElementAt(i).Key.LstAdress;
                        lbNumb.Content = (i + 1).ToString();
                        break;
                    }
                    if (MTControler.IsEqual(_dicSearch.ElementAt(i).Key.LstAdress, SelectedPatch))
                    {
                        bSet = true;
                    }
                }
            }
            Action(this);
        }
예제 #19
0
        public string GetAdrees()
        {
            string sText = "";

            if (lvMap.SelectedItems.Count > 0)
            {
                if ((lvMap.SelectedItems[0] as MTBookModel) != null)
                {
                    MTBookModel objBook = lvMap.SelectedItem as MTBookModel;
                    sText = MTControler.GetAdrees(objBook, false);
                }
                else if ((lvMap.SelectedItems[0] as MTChapterModel) != null)
                {
                    MTChapterModel objChapter = lvMap.SelectedItem as MTChapterModel;
                    sText = MTControler.GetAdrees(objChapter, false);
                }
                else if ((lvMap.SelectedItems[0] as MTVerseModel) != null)
                {
                    sText = MTControler.GetAdrees(SelectedPatch, false);
                }
            }
            return(sText);
        }
예제 #20
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);
        }
예제 #21
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     MTControler.Initialize();
 }