Esempio n. 1
0
        private void FillOtherWordsListFromTextFile()
        {
            if (!Directory.Exists(@"C:\ProgramData\learnLatin"))
            {
                Directory.CreateDirectory(@"C:\ProgramData\learnLatin");
            }

            if (!File.Exists(@"C:\ProgramData\learnLatin\OtherWords.txt"))
            {
                return;
            }

            this.OtherWordsList.Clear();

            var stream = new FileStream(@"C:\ProgramData\learnLatin\OtherWords.txt", FileMode.Open, FileAccess.Read);
            var reader = new StreamReader(stream);

            var line = String.Empty;

            while ((line = reader.ReadLine()) != null)
            {
                var word = new OtherWord(String.Empty, String.Empty);

                word.Lateinisch = line.Split(';')[0];
                word.Deutsch    = line.Split(';')[1];

                this.OtherWordsList.Add(word);
            }


            reader.Close();
            stream.Close();
        }
Esempio n. 2
0
        private void Btn_NaechstesWort_Click(object sender, EventArgs e)
        {
            this.ausgewaehltesWort = CollectionExtension.RandomElement(this.OtherWordsList);

            this.txtBox_Lateinisch.Text = this.ausgewaehltesWort.Lateinisch;

            this.ClearTextBoxes();
        }
Esempio n. 3
0
        private void Btn_WortHinzufuegen_Click(object sender, EventArgs e)
        {
            var word = new OtherWord(this.txtBox_Lateinisch.Text, this.txtBox_Deutsch.Text);

            this.OtherWordsList.Add(word);

            word = null;

            this.SaveOtherWordsListAsTextFile();

            MessageBox.Show("Das Wort wurde erfolgreich hinzugefügt!");

            this.btn_NaechstesWort.PerformClick();
        }