Exemplo n.º 1
0
        /// <summary>
        /// Synchronisiert Datenbank mit den Listen
        /// </summary>
        private void UpdateDatabase()
        {
            DBAdapter.DeleteAllVocables(dbFilePath);

            DBAdapter.AddVocabulary(dbFilePath, Fach1, 1);
            DBAdapter.AddVocabulary(dbFilePath, Fach2, 2);
            DBAdapter.AddVocabulary(dbFilePath, Fach3, 3);
            DBAdapter.AddVocabulary(dbFilePath, Fach4, 4);
            DBAdapter.AddVocabulary(dbFilePath, Fach5, 5);
            DBAdapter.AddVocabulary(dbFilePath, Fach6, 6);
            DBAdapter.AddVocabulary(dbFilePath, Fach7, 7);
            DBAdapter.AddVocabulary(dbFilePath, Fach8, 8);
            DBAdapter.AddVocabulary(dbFilePath, Fach9, 9);
            DBAdapter.AddVocabulary(dbFilePath, Fach10, 10);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fügt die Vokabel zur Liste hinzu
        /// </summary>
        private void AddVocableToList()
        {
            Miscellaneous.DoThisSpaceStuff(ref tb_AddVocs_ES, ref tb_AddVocs_FS);

            Dictionary <string, string> VocabularyMap = new Dictionary <string, string>();

            VocabularyMap.Add(tb_AddVocs_ES.Text.Trim(), tb_AddVocs_FS.Text.Trim());

            if (!DBAdapter.AddVocabulary(dbFilePath, VocabularyMap, 1))
            {
                MessageBox.Show("Die Vokabel, die du eingegeben hast existiert bereits in deiner Box. Sie wurde übersprungen, sodass du wie gewohnt fortfahren kannst", "Nur zur Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            tb_AddVocs_ES.Text = "";
            tb_AddVocs_FS.Text = "";
            tb_AddVocs_ES.Focus();

            AddVocsIsFilled();
        }
Exemplo n.º 3
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);
                }
            }
        }