Exemplo n.º 1
0
        /// <summary>
        /// If Clicked on a Translation Element
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void act_ClickOnTranslationElement(object sender, EventArgs e)
        {
            lastTransButton  = (Button)sender;
            lastNativeButton = (Button)lastTransButton.Tag;

            classNumber = Convert.ToInt32(lastNativeButton.Text.Substring(1, 1));
            currentVoc  = lastNativeButton.Text.Substring(4).Trim();
            string sTranslation = ((Button)sender).Text;

            tb_EigeneSprache.Text = currentVoc;
            tb_Fremdsprache.Text  = sTranslation;

            lb_title_ES.Text = DBAdapter.GetLabelEntry(dbFilePath, "nativeLanguage") + ":";
            lb_title_FS.Text = DBAdapter.GetLabelEntry(dbFilePath, "translationLanguage") + ":";

            btn_save.Enabled   = false;
            btn_save.ForeColor = Color.Gray;
            pnl_Info.Visible   = true;
            lb_Info_Title.Text = "Vokabel bearbeiten:";
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets informations from a database
        /// </summary>
        /// <param name="sName">Name of the database</param>
        private void getInformations(string sName)
        {
            lb_Info_Title.Text = "INFORMATIONEN ZUR AUSGEWÄHLTEN BOX:";
            pnl_Info.Visible   = true;

            string dbFilePath = Miscellaneous.GenealValues.APPDATA_PATH + sName + ".db";

            lb_ES.Text        = DBAdapter.GetLabelEntry(dbFilePath, "nativeLanguage");
            lb_FS.Text        = DBAdapter.GetLabelEntry(dbFilePath, "translationLanguage");
            lb_createdAt.Text = DBAdapter.GetLabelEntry(dbFilePath, "thisCreated");

            string lastLearned = DBAdapter.GetLabelEntry(dbFilePath, "lastLearned");

            if (lastLearned != "never")
            {
                lb_lastLearned.Text = lastLearned;
            }
            else
            {
                lb_lastLearned.Text = "Noch nicht gelernt";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Löscht eine Vokabel Aus
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void act_DeleteVoc(object sender, EventArgs e)
        {
            switch (classNumber)
            {
            case 1:
                Fach1.Remove(currentVoc);
                if (Fach1.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 2:
                Fach2.Remove(currentVoc);
                if (Fach2.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 3:
                Fach3.Remove(currentVoc);
                if (Fach3.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 4:
                Fach4.Remove(currentVoc);
                if (Fach4.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 5:
                Fach5.Remove(currentVoc);
                if (Fach5.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 6:
                Fach6.Remove(currentVoc);
                if (Fach6.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 7:
                Fach7.Remove(currentVoc);
                if (Fach7.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 8:
                Fach8.Remove(currentVoc);
                if (Fach8.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 9:
                Fach9.Remove(currentVoc);
                if (Fach9.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;

            case 10:
                Fach10.Remove(currentVoc);
                if (Fach10.Count == 0)
                {
                    DBAdapter.UpdateLabel(dbFilePath, "lastClass", "none");
                }
                break;
            }

            UpdateElements();
            UpdateDatabase();

            pnl_Info.Visible   = false;
            lb_Info_Title.Text = "Wählen sie eine Vokabel aus, um sie zu bearbeiten";
        }
Exemplo n.º 4
0
        /// <summary>
        /// If Clicked on a Native Element
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void act_ClickOnNativeElement(object sender, EventArgs e)
        {
            lastNativeButton = (Button)sender;
            lastTransButton  = (Button)lastNativeButton.Tag;
            classNumber      = Convert.ToInt32(((Button)sender).Text.Substring(1, 1));
            currentVoc       = lastNativeButton.Text.Substring(4).Trim();
            string sTranslation = "";

            // Holt die Fremd-Vokabel
            switch (classNumber)
            {
            case 1:
                sTranslation = Fach1[currentVoc];
                break;

            case 2:
                sTranslation = Fach2[currentVoc];
                break;

            case 3:
                sTranslation = Fach3[currentVoc];
                break;

            case 4:
                sTranslation = Fach4[currentVoc];
                break;

            case 5:
                sTranslation = Fach5[currentVoc];
                break;

            case 6:
                sTranslation = Fach6[currentVoc];
                break;

            case 7:
                sTranslation = Fach7[currentVoc];
                break;

            case 8:
                sTranslation = Fach8[currentVoc];
                break;

            case 9:
                sTranslation = Fach9[currentVoc];
                break;

            case 10:
                sTranslation = Fach10[currentVoc];
                break;
            }

            tb_EigeneSprache.Text = currentVoc;
            tb_Fremdsprache.Text  = sTranslation;

            lb_title_ES.Text = DBAdapter.GetLabelEntry(dbFilePath, "nativeLanguage") + ":";
            lb_title_FS.Text = DBAdapter.GetLabelEntry(dbFilePath, "translationLanguage") + ":";

            btn_save.Enabled   = false;
            btn_save.ForeColor = Color.Gray;
            pnl_Info.Visible   = true;
            lb_Info_Title.Text = "Vokabel bearbeiten:";
        }
Exemplo n.º 5
0
        /// <summary>
        /// Speichern der Datei
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void act_saveBox(object sender, EventArgs e)
        {
            if (pnl_save.BackColor == DBAdapter.GetSettingsColorEntry(Miscellaneous.GenealValues.SETTINGS_FILE_PATH, "CreateNew"))
            {
                if (!pnl_addVocs.Visible)
                {
                    if (!File.Exists(Miscellaneous.GenealValues.APPDATA_PATH + tb_Name.Text + ".db"))
                    {
                        tb_Name.Enabled            = false;
                        tb_EigeneSprache.Enabled   = false;
                        tb_Fremdsprache.Enabled    = false;
                        comb_EigeneSprache.Enabled = false;
                        comb_Fremdsprache.Enabled  = false;

                        s_NameDerBox = tb_Name.Text.Trim();

                        if (comb_EigeneSprache.Text == "Manuell eingeben >>")
                        {
                            s_EigeneSprache = tb_EigeneSprache.Text.Trim();
                        }
                        else
                        {
                            s_EigeneSprache = comb_EigeneSprache.Text;
                        }

                        if (comb_Fremdsprache.Text == "Manuell eingeben >>")
                        {
                            s_Fremdsprache = tb_Fremdsprache.Text.Trim();
                        }
                        else
                        {
                            s_Fremdsprache = comb_Fremdsprache.Text;
                        }

                        lb_AddVocs_ES.Text  = s_EigeneSprache + " :";
                        lb_AddVocs_FS.Text  = s_Fremdsprache + " :";
                        pnl_addVocs.Visible = true;
                        lb_Warnung.Visible  = false;

                        lb_back.Visible = false;

                        lb_save.Text = "FERTIG";
                    }
                    else
                    {
                        MessageBox.Show("Es existiert bereits eine Box mit dem Namen '" + tb_Name.Text + "' \nGehe zu Hauptmenü > Öffnen um deine Boxen zu verwalten", "Fehler aufgetreten", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    string dbFilePath = Miscellaneous.GenealValues.APPDATA_PATH + s_NameDerBox + ".db";

                    DBAdapter.CreateDatabase(dbFilePath);
                    DBAdapter.AddLabel(dbFilePath, "nativeLanguage", s_EigeneSprache);
                    DBAdapter.AddLabel(dbFilePath, "translationLanguage", s_Fremdsprache);
                    DBAdapter.AddLabel(dbFilePath, "thisCreated", DateTime.Today.ToString("d"));
                    DBAdapter.AddLabel(dbFilePath, "lastLearned", "never");
                    DBAdapter.AddLabel(dbFilePath, "lastClass", "none");

                    DBAdapter.AddVocabulary(dbFilePath, VocabularyMap, 1);

                    CloseMeFunction?.Invoke(this, null);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Wenn der benutzer auf WEITER klickt
        /// </summary>
        private void act_Continue()
        {
            if (btn_Continue.Text == "BESTÄTIGEN")
            {
                // Abfragerichtung bestimmen
                if (direction)
                {
                    string writtenAnswer  = tb_Fremdsprache.Text;
                    string withoutComment = Regex.Replace(transVoc, @"\[.*?\]", "").Trim();

                    if (!cb_GrossKleinSchreibung.Checked)
                    {
                        withoutComment = withoutComment.ToLower();
                    }
                    if (!cb_GrossKleinSchreibung.Checked)
                    {
                        writtenAnswer = writtenAnswer.ToLower();
                    }

                    // Aufteilung in mehrere Bedeutungen für das selbe Wort
                    if (withoutComment.Split(Miscellaneous.BoxValues.MULTIPLE_MEANING_SEPERATOR).Contains(writtenAnswer))
                    {
                        wasRight = true;
                    }
                    else
                    {
                        wasRight = false;
                    }

                    tb_Fremdsprache.Text = string.Join(" | ", withoutComment.Split('|'));
                }
                else
                {
                    string writtenAnswer  = tb_EigeneSprache.Text;
                    string withoutComment = Regex.Replace(currentVoc, @"\[.*?\]", "").Trim();

                    if (!cb_GrossKleinSchreibung.Checked)
                    {
                        withoutComment = withoutComment.ToLower();
                    }
                    if (!cb_GrossKleinSchreibung.Checked)
                    {
                        writtenAnswer = writtenAnswer.ToLower();
                    }

                    // Aufteilung in mehrere Bedeutungen für das selbe Wort
                    if (withoutComment.Split(Miscellaneous.BoxValues.MULTIPLE_MEANING_SEPERATOR).Contains(writtenAnswer))
                    {
                        wasRight = true;
                    }
                    else
                    {
                        wasRight = false;
                    }

                    tb_EigeneSprache.Text = string.Join(" | ", withoutComment.Split('|'));
                }

                // Farbe ändern
                if (wasRight)
                {
                    tb_EigeneSprache.ForeColor = Color.Green;
                    tb_Fremdsprache.ForeColor  = Color.Green;
                    btn_Continue.ForeColor     = Color.Green;
                }
                else
                {
                    tb_EigeneSprache.ForeColor = Color.Red;
                    tb_Fremdsprache.ForeColor  = Color.Red;
                    btn_Continue.ForeColor     = Color.Red;

                    btn_Vertippt.Visible = true;
                }

                gb_Optionen.Enabled = false;
                btn_Continue.Text   = "WEITER";
            }
            else if (btn_Continue.Text == "WEITER")
            {
                DBAdapter.UpdateLabel(dbFilePath, "lastLearned", DateTime.Today.ToString("d"));

                // Alte Vokabel Verwaltung
                if (wasRight)
                {
                    StatsAddEntry(true);

                    if (currentClass != 10)
                    {
                        Fach[currentClass].Remove(currentVoc);
                        Fach[currentClass + 1].Add(currentVoc, transVoc);
                        DBAdapter.ChangeVocableClass(dbFilePath, currentVoc, currentClass + 1);
                    }
                    else
                    {
                        Fach[currentClass].Remove(currentVoc);
                        Fach[0].Add(currentVoc, transVoc);
                        DBAdapter.ChangeVocableClass(dbFilePath, currentVoc, 0);
                    }

                    UpdateClassVisibility();
                }
                else
                {
                    StatsAddEntry(false);

                    if (cb_BackToOne.Checked)
                    {
                        Fach[currentClass].Remove(currentVoc);
                        Fach[1].Add(currentVoc, transVoc);
                        DBAdapter.ChangeVocableClass(dbFilePath, currentVoc, 1);
                    }

                    UpdateClassVisibility();
                }

                btn_Vertippt.Visible       = false;
                btn_Continue.ForeColor     = SystemColors.ControlText;
                btn_Continue.Text          = "BESTÄTIGEN";
                gb_Optionen.Enabled        = true;
                tb_EigeneSprache.ForeColor = SystemColors.ControlText;
                tb_Fremdsprache.ForeColor  = SystemColors.ControlText;

                // Nächste Vokabel
                int countCurrentClass = Fach[currentClass].Count();

                if (countCurrentClass > 0)
                {
                    NextExercise();
                }
                else
                {
                    if (currentClass == 1)
                    {
                        FindNewClass();
                        DBAdapter.UpdateLabel(dbFilePath, "lastClass", currentClass.ToString());

                        if (MessageBox.Show("Du hast die Box nun einmal durchgelernt. Es ist empfohlen in regelmäßigen Abständen zu lernen. Möchtest du weiter lernen?", "Weiter lernen?",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            NextExercise();
                        }
                        else
                        {
                            CloseMeFunction?.Invoke(this, null);
                        }
                    }
                    else
                    {
                        while (!FindNextClass())
                        {
                            currentClass--;

                            if (currentClass == 0)
                            {
                                FindNewClass();
                                DBAdapter.UpdateLabel(dbFilePath, "lastClass", currentClass.ToString());

                                if (MessageBox.Show("Du hast die Box nun einmal durchgelernt. Es ist empfohlen in regelmäßigen Abständen zu lernen. Möchtest du weiter lernen?", "Weiter lernen?",
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    NextExercise();
                                }
                                else
                                {
                                    CloseMeFunction?.Invoke(this, null);
                                }
                            }
                        }

                        NextExercise();
                    }
                }
            }
        }
Exemplo n.º 7
0
        public LearnBox(string boxNameFromRecent)
        {
            InitializeComponent();

            dbFilePath    = Miscellaneous.GenealValues.APPDATA_PATH + boxNameFromRecent + ".db";
            lb_Title.Text = boxNameFromRecent;

            startWindow = DateTime.Now;

            lb_EigeneSprache.Text = DBAdapter.GetLabelEntry(dbFilePath, "nativeLanguage") + ":";
            lb_Fremdsprache.Text  = DBAdapter.GetLabelEntry(dbFilePath, "translationLanguage") + ":";
            lb_DirectionEF.Text   = DBAdapter.GetLabelEntry(dbFilePath, "nativeLanguage") + " > " + DBAdapter.GetLabelEntry(dbFilePath, "translationLanguage");
            lb_DirectionFE.Text   = DBAdapter.GetLabelEntry(dbFilePath, "translationLanguage") + " > " + DBAdapter.GetLabelEntry(dbFilePath, "nativeLanguage");

            Fach[0]  = DBAdapter.GetVocsByClass(dbFilePath, 0);
            Fach[1]  = DBAdapter.GetVocsByClass(dbFilePath, 1);
            Fach[2]  = DBAdapter.GetVocsByClass(dbFilePath, 2);
            Fach[3]  = DBAdapter.GetVocsByClass(dbFilePath, 3);
            Fach[4]  = DBAdapter.GetVocsByClass(dbFilePath, 4);
            Fach[5]  = DBAdapter.GetVocsByClass(dbFilePath, 5);
            Fach[6]  = DBAdapter.GetVocsByClass(dbFilePath, 6);
            Fach[7]  = DBAdapter.GetVocsByClass(dbFilePath, 7);
            Fach[8]  = DBAdapter.GetVocsByClass(dbFilePath, 8);
            Fach[9]  = DBAdapter.GetVocsByClass(dbFilePath, 9);
            Fach[10] = DBAdapter.GetVocsByClass(dbFilePath, 10);

            if (DBAdapter.GetLabelEntry(dbFilePath, "lastClass") == "none")
            {
                if (!FindNewClass())
                {
                    MessageBox.Show("In der Ausgewählten Box sind keine Vokabeln enthalten. Gehe zu Hauptmenü > Vorhandene Box öffnen > Vokabeln verwalten um neue Vokabeln hinzufügen", "Keine Vokabeln gefunden", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    CloseMeFunction?.Invoke(this, null);
                }
            }
            else
            {
                currentClass = Convert.ToInt32(DBAdapter.GetLabelEntry(dbFilePath, "lastClass"));
            }

            DBAdapter.UpdateLabel(dbFilePath, "lastClass", currentClass.ToString());

            NextExercise();
            UpdateClassVisibility();

            sts_info.BackColor = Miscellaneous.CustomColors.LearnBox;
        }