public mysql_test(Preferences.MySQLRow mysqlRow)
        {
            this.mysqlRow = mysqlRow;

            bool testCheck = testConnection();
            if (testCheck == false)
            {
                InitializeComponent();

                this.testingLabel.Visible = false;
                this.failedLabel.Visible = true;
                this.exceptionText.Text = this.mysqlException;
            }
            else
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Beispiel #2
0
        private void loadPreferences()
        {
            Preferences preferences = new Preferences();
            if (System.IO.File.Exists(preferencesFile))
            {
                foreach (DataTable dataTable in preferences.Tables) dataTable.BeginLoadData();
                preferences.ReadXml(preferencesFile);
                foreach (DataTable dataTable in preferences.Tables) dataTable.EndLoadData();

                //Prüfen ob irgendwelche Datensätze DBNull enthalten, wenn ja, dann preferences Fenster öffnen
                bool checkPreferences = false;
                foreach (DataColumn column in preferences.MySQL.Columns)
                {
                    if (preferences.MySQL.Rows[0].IsNull(column.ColumnName)) checkPreferences = true;
                    //if (preferences.MySQL.Rows[0][column.ColumnName].GetType().ToString() == System.DBNull.Value.GetType().ToString()) checkPreferences = true;
                }

                foreach (DataColumn column in preferences.Basic.Columns)
                {
                    if (preferences.Basic.Rows[0].IsNull(column.ColumnName)) checkPreferences = true;
                    //if (preferences.Basic.Rows[0][column.ColumnName].GetType().ToString() == System.DBNull.Value.GetType().ToString()) checkPreferences = true;
                }

                if (checkPreferences == true)
                {
                    MessageBox.Show(Locales.GetString("preferences_new_options"));
                    preferencesToolStripMenuItem_Click(null, null);
                    return;
                }

            }
            else
            {
                Preferences.MySQLRow mysqlRow = preferences.MySQL.NewMySQLRow();
                preferences.MySQL.Rows.Add(mysqlRow);

                Preferences.BasicRow basicRow = preferences.Basic.NewBasicRow();
                preferences.Basic.Rows.Add(basicRow);

                preferences.WriteXml(preferencesFile);
                loadPreferences();
                return;
            }

            this.mysqlRow = (Preferences.MySQLRow)preferences.MySQL.Rows[0];
            this.basicRow = (Preferences.BasicRow)preferences.Basic.Rows[0];
        }