Example #1
0
        public void SetWrongAnswers()
        {
            var rnd        = new Random();
            int wordAmount = WordPool.GetSizeOfPool();

            for (int i = 0; i < 20; ++i)
            {
                int wordNumber = rnd.Next(wordAmount);
                if (wordNumber != answers[i / 2])
                {
                    if (i % 2 == 1)
                    {
                        if (wordNumber != wrongAnswers[i - 1])
                        {
                            wrongAnswers[i] = wordNumber;
                        }
                        else
                        {
                            i--;
                        }
                    }
                    else
                    {
                        wrongAnswers[i] = wordNumber;
                    }
                }
                else
                {
                    i--;
                }
            }
        }
Example #2
0
        protected void SetAnswers()
        {
            var rnd        = new Random();
            int wordAmount = WordPool.GetSizeOfPool();

            for (int i = 0; i < 10; ++i)
            {
                int wordNumber = rnd.Next(wordAmount);
                for (int j = 0; j <= i; ++j)
                {
                    if (i == 0)
                    {
                        answers[i] = wordNumber;
                    }
                    else if (answers[j] == wordNumber)
                    {
                        i--;
                        break;
                    }
                    if (j == i)
                    {
                        answers[i] = wordNumber;
                    }
                }
            }
        }
Example #3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            WordPool.Set(Id, PolishWord.Text.ToString(), EnglishWord.Text.ToString());
            WordList window = new WordList();

            window.Show();
            this.Close();
        }
Example #4
0
        protected void GetWord()
        {
            var rnd        = new Random();
            int wordAmount = WordPool.GetSizeOfPool();
            int wordNumber = rnd.Next(wordAmount - 1);

            answear = WordPool.Get(wordNumber);
            WordPool.Release(wordNumber);
        }
Example #5
0
        public static void SaveToFileWords()

        {
            MyStream = new FileStream("C:\\Users\\" + Environment.UserName + "\\Desktop\\data.dat", FileMode.Create);
            BinaryFormatter MyFormatter = new BinaryFormatter();

            MyFormatter.Serialize(MyStream, WordPool.GetWordPool());
            MyStream.Close();
        }
Example #6
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            int id = lvWords.SelectedIndex;

            WordPool.Delete(id);
            WordList window = new WordList();

            window.Show();
            this.Close();
        }
Example #7
0
        public WordUpdate(int id)
        {
            InitializeComponent();
            string pname = WordPool.Get(id).GetPolishName();;

            WordPool.Release(id);
            string ename = WordPool.Get(id).GetEnglishName();;

            WordPool.Release(id);
            PolishWord.Text  = pname;
            EnglishWord.Text = ename;
            Id = id;
        }
Example #8
0
        public WordList()
        {
            InitializeComponent();
            List <Row> Rows = new List <Row>();

            for (int i = 0; i < WordPool.GetSizeOfPool(); i++)
            {
                string pname = WordPool.Get(i).GetPolishName();;
                WordPool.Release(i);
                string ename = WordPool.Get(i).GetEnglishName();;
                WordPool.Release(i);
                Rows.Add(new Row()
                {
                    pName = pname, eName = ename
                });
            }
            lvWords.ItemsSource = Rows;
        }
Example #9
0
        public override void StartMode()
        {
            for (int i = 0; i < 10; i++)
            {
                if (endTest == true)
                {
                    break;
                }
                HardTest window = new HardTest();
                window.SetType(true);
                string words;
                if (Program.GetLearnType() == false)
                {
                    String word = WordPool.Get(answers[i]).GetPolishName();
                    WordPool.Release(answers[i]);
                    words = WordPool.Get(answers[i]).GetEnglishName();
                    WordPool.Release(answers[i]);
                    window.SetWord(word);
                    window.SetCorrectAnswer(words);
                }
                else
                {
                    String word = WordPool.Get(answers[i]).GetEnglishName();
                    WordPool.Release(answers[i]);
                    words = WordPool.Get(answers[i]).GetPolishName();
                    WordPool.Release(answers[i]);
                    window.SetWord(word);
                    window.SetCorrectAnswer(words);
                }

                window.ShowDialog();

                if (window.correct == 3)
                {
                    endTest = true;
                }
            }
        }
Example #10
0
        public override void StartMode()
        {
            for (int i = 0; i < 10; i++)
            {
                if (endTest == true)
                {
                    break;
                }
                EasyTest window = new EasyTest();
                window.SetType(true);
                string[] words = new string[3];
                if (Program.GetLearnType() == false)
                {
                    String word = WordPool.Get(answers[i]).GetPolishName();
                    WordPool.Release(answers[i]);
                    words[0] = WordPool.Get(answers[i]).GetEnglishName();
                    WordPool.Release(answers[i]);
                    words[1] = WordPool.Get(wrongAnswers[i * 2]).GetEnglishName();
                    WordPool.Release(wrongAnswers[i * 2]);
                    words[2] = WordPool.Get(wrongAnswers[i * 2 + 1]).GetEnglishName();
                    WordPool.Release(wrongAnswers[i * 2 + 1]);
                    window.SetWord(word);
                    window.SetCorrectAnswer(words[0]);
                }
                else
                {
                    String word = WordPool.Get(answers[i]).GetEnglishName();
                    WordPool.Release(answers[i]);
                    words[0] = WordPool.Get(answers[i]).GetPolishName();
                    WordPool.Release(answers[i]);
                    words[1] = WordPool.Get(wrongAnswers[i * 2]).GetPolishName();
                    WordPool.Release(wrongAnswers[i * 2]);
                    words[2] = WordPool.Get(wrongAnswers[i * 2 + 1]).GetPolishName();
                    WordPool.Release(wrongAnswers[i * 2 + 1]);
                    window.SetWord(word);
                    window.SetCorrectAnswer(words[0]);
                }
                var rand = new Random();
                int nmb  = rand.Next(0, 2);
                if (nmb == 0)
                {
                    window.SetAnswer1(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer3(words[2]);
                }
                if (nmb == 1)
                {
                    window.SetAnswer2(words[0]);
                    window.SetAnswer1(words[1]);
                    window.SetAnswer3(words[2]);
                }
                if (nmb == 3)
                {
                    window.SetAnswer3(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer1(words[2]);
                }


                window.ShowDialog();

                /*
                 * if (window.correct == 1)
                 * {
                 *  IncreaseCorrectAnswears();
                 * }*/
                if (window.correct == 3)
                {
                    endTest = true;
                }
            }
        }
Example #11
0
 public static void LoadWords()
 {
     WordPool.LoadFromFileWords();
 }
Example #12
0
 public static void SaveWords()
 {
     WordPool.SaveToFileWords();
 }
Example #13
0
 public static void DeleteWord(String name, bool english)
 {
     WordPool.Delete(name, english);
 }
Example #14
0
 public static Word GetWord(int i)
 {
     return(WordPool.Get(i));
 }
Example #15
0
 public static void AddWord(string polish, string english)
 {
     WordPool.Add(new Word(polish, english));
 }
Example #16
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     WordPool.SaveToFileWords();
     this.Close();
 }
Example #17
0
        public override void StartMode()
        {
            for (int i = 0; i < 10; i++)
            {
                if (endTest == true)
                {
                    break;
                }
                MediumTest window = new MediumTest();
                window.SetType(true);
                string[] words = new string[6];
                if (Program.GetLearnType() == false)
                {
                    String word = WordPool.Get(answers[i]).GetPolishName();
                    WordPool.Release(answers[i]);
                    words[0] = WordPool.Get(answers[i]).GetEnglishName();
                    WordPool.Release(answers[i]);
                    words[1] = WordPool.Get(wrongAnswers[i * 4]).GetEnglishName();
                    WordPool.Release(wrongAnswers[i * 4]);
                    words[2] = WordPool.Get(wrongAnswers[i * 4 + 1]).GetEnglishName();
                    WordPool.Release(wrongAnswers[i * 4 + 1]);
                    words[3] = WordPool.Get(wrongAnswers[i * 4 + 2]).GetEnglishName();
                    WordPool.Release(wrongAnswers[i * 4 + 2]);
                    words[4] = WordPool.Get(wrongAnswers[i * 4 + 3]).GetEnglishName();
                    WordPool.Release(wrongAnswers[i * 4 + 3]);
                    window.SetWord(word);
                    window.SetCorrectAnswer(words[0]);
                }
                else
                {
                    String word = WordPool.Get(answers[i]).GetEnglishName();
                    WordPool.Release(answers[i]);
                    words[0] = WordPool.Get(answers[i]).GetPolishName();
                    WordPool.Release(answers[i]);
                    words[1] = WordPool.Get(wrongAnswers[i * 4]).GetPolishName();
                    WordPool.Release(wrongAnswers[i * 4]);
                    words[2] = WordPool.Get(wrongAnswers[i * 4 + 1]).GetPolishName();
                    WordPool.Release(wrongAnswers[i * 4 + 1]);
                    words[3] = WordPool.Get(wrongAnswers[i * 4 + 2]).GetPolishName();
                    WordPool.Release(wrongAnswers[i * 4 + 2]);
                    words[4] = WordPool.Get(wrongAnswers[i * 4 + 3]).GetPolishName();
                    WordPool.Release(wrongAnswers[i * 4 + 3]);
                    window.SetWord(word);
                    window.SetCorrectAnswer(words[0]);
                }

                var rand = new Random();
                int nmb  = rand.Next(0, 5);
                if (nmb == 0)
                {
                    window.SetAnswer1(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer3(words[2]);
                    window.SetAnswer4(words[3]);
                    window.SetAnswer5(words[4]);
                }
                if (nmb == 1)
                {
                    window.SetAnswer2(words[0]);
                    window.SetAnswer1(words[1]);
                    window.SetAnswer3(words[2]);
                    window.SetAnswer4(words[3]);
                    window.SetAnswer5(words[4]);
                }
                if (nmb == 2)
                {
                    window.SetAnswer3(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer1(words[2]);
                    window.SetAnswer4(words[3]);
                    window.SetAnswer5(words[4]);
                }
                if (nmb == 3)
                {
                    window.SetAnswer4(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer1(words[2]);
                    window.SetAnswer3(words[3]);
                    window.SetAnswer5(words[4]);
                }
                if (nmb == 4)
                {
                    window.SetAnswer5(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer1(words[2]);
                    window.SetAnswer4(words[3]);
                    window.SetAnswer3(words[4]);
                }

                window.ShowDialog();

                if (window.correct == 3)
                {
                    endTest = true;
                }
            }
        }
Example #18
0
        protected override void ShowQuestion()
        {
            EasyTest window = new EasyTest();
            Word     tmp;

            string[] words = new string[3];
            int      i     = 0;

            if (Program.GetLearnType() == false)
            {
                words[0] = GetAnswear().GetEnglishName();
                i++;
                String word = GetAnswear().GetPolishName();
                window.SetWord(word);
                window.SetCorrectAnswer(GetAnswear().GetEnglishName());
                while (i != 3)
                {
                    int correct    = 1;
                    var rnd        = new Random();
                    int wordAmount = WordPool.GetSizeOfPool();
                    int wordNumber = rnd.Next(wordAmount - 1);
                    tmp = WordPool.Get(wordNumber);
                    WordPool.Release(wordNumber);
                    for (int j = 0; j < i; j++)
                    {
                        if (tmp.GetEnglishName() == words[j])
                        {
                            correct = 0;
                        }
                    }
                    if (correct == 1)
                    {
                        words[i] = tmp.GetEnglishName();
                        i++;
                    }
                }
                var rand = new Random();
                int nmb  = rand.Next(0, 3);
                if (nmb == 0)
                {
                    window.SetAnswer1(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer3(words[2]);
                }
                if (nmb == 1)
                {
                    window.SetAnswer2(words[0]);
                    window.SetAnswer1(words[1]);
                    window.SetAnswer3(words[2]);
                }
                if (nmb == 2)
                {
                    window.SetAnswer3(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer1(words[2]);
                }
            }
            if (Program.GetLearnType() == true)
            {
                words[0] = GetAnswear().GetPolishName();
                i++;
                String word = GetAnswear().GetEnglishName();
                window.SetWord(word);
                window.SetCorrectAnswer(GetAnswear().GetPolishName());
                while (i != 3)
                {
                    int correct    = 1;
                    var rnd        = new Random();
                    int wordAmount = WordPool.GetSizeOfPool();
                    int wordNumber = rnd.Next(wordAmount - 1);
                    tmp = WordPool.Get(wordNumber);
                    WordPool.Release(wordNumber);
                    for (int j = 0; j < i; j++)
                    {
                        if (tmp.GetPolishName() == words[j])
                        {
                            correct = 0;
                        }
                    }
                    if (correct == 1)
                    {
                        words[i] = tmp.GetPolishName();
                        i++;
                    }
                }
                var rand = new Random();
                int nmb  = rand.Next(0, 3);
                if (nmb == 0)
                {
                    window.SetAnswer1(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer3(words[2]);
                }
                if (nmb == 1)
                {
                    window.SetAnswer2(words[0]);
                    window.SetAnswer1(words[1]);
                    window.SetAnswer3(words[2]);
                }
                if (nmb == 2)
                {
                    window.SetAnswer3(words[0]);
                    window.SetAnswer2(words[1]);
                    window.SetAnswer1(words[2]);
                }
            }
            window.ShowDialog();

            if (window.correct == 1)
            {
                IncreaseCorrectAnswears();
            }
            if (window.correct == 3)
            {
                endTest = true;
            }
        }