Beispiel #1
0
        // loads settings and sets the values on the mainwindow
        public void LoadSettings(MainWindow window)
        {
            sql = "select * from settings";
            dbConnection.Open();
            command = new SQLiteCommand(sql, dbConnection);
            reader  = command.ExecuteReader();

            while (reader.Read())
            {
                window.DifficultyMode = reader.GetInt32(0);
                window.MineCount      = reader.GetInt32(1);
                window.RowCount       = reader.GetInt32(2);
                window.ColumnCount    = reader.GetInt32(3);
                window.Width          = reader.GetInt32(4);
                window.Height         = reader.GetInt32(5);
                if (reader.GetInt32(6) == 1)
                {
                    window.WindowState = System.Windows.WindowState.Maximized;
                }
                window.gridColor = reader.GetString(7);
                window.SetFlag(reader.GetString(7));
                window.backColor = reader.GetString(8);
            }
            dbConnection.Close();

            // create an options window just to get the colors for the mainwindow (lazy method)
            OptionsWindow ow = new OptionsWindow();

            window.Background = ow.GetColor(window.backColor);
            window.GridColor  = ow.GetColor(window.gridColor);
            ow.Close();
        }
Beispiel #2
0
        private void BtnOptions_Click(object sender, RoutedEventArgs e)
        {
            OptionsWindow w = new OptionsWindow(this);

            w.Show();
        }