Exemplo n.º 1
0
        /// <summary>
        /// Applys user settings
        /// </summary>
        /// <param name="settings"></param>
        private void ChangeSettings(SettingsEventArgs settings)
        {
            #region Change settings of puzzle pieces
            for (int i = 0; i < Puzzle.NUM_PIECES; i++)
            {
                pieces[i].Font      = settings.Font;
                pieces[i].BackColor = settings.BackColor;
                pieces[i].ForeColor = settings.ForeColor;

                if (pieces[i].Text == String.Empty)
                {
                    pieces[i].BackColor = settings.ForeColor;
                }
            }
            emptyPieceColor     = settings.ForeColor;
            suggestedPieceColor = settings.SuggestedTileColor;
            possiblePieceColor  = settings.PossibleTilesColor;
            #endregion

            #region Change settings of GroupBox controls
            groupBoxOptions.ForeColor   = settings.ForeColor;
            groupBoxConfigs.ForeColor   = settings.ForeColor;
            groupBoxPlayModes.ForeColor = settings.ForeColor;
            groupBoxStats.ForeColor     = settings.ForeColor;
            #endregion

            #region Change settings of Button controls
            btnSettings.ForeColor     = settings.ForeColor;
            btnShuffle.ForeColor      = settings.ForeColor;
            btnCustomConfig.ForeColor = settings.ForeColor;
            btnNext.ForeColor         = settings.ForeColor;
            btnAutoPlay.ForeColor     = settings.ForeColor;
            #endregion

            #region Change settings of Label controls
            labelMoveText.BackColor    = settings.ForeColor;
            labelMovesText.BackColor   = settings.ForeColor;
            labelOfText.ForeColor      = settings.ForeColor;
            labelStatus.BackColor      = settings.ForeColor;
            labelMoveText.ForeColor    = settings.BackColor;
            labelMovesText.ForeColor   = settings.BackColor;
            labelCurrentMove.ForeColor = settings.SecForeColor;
            labelMovesNeeded.ForeColor = settings.SecForeColor;
            labelStatus.ForeColor      = settings.BackColor;
            #endregion

            #region Change settings of Form
            BackColor = settings.BackColor;
            #endregion
        }
Exemplo n.º 2
0
        /// <summary>
        /// Saves user settings
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSettingsChanged(object sender, SettingsEventArgs e)
        {
            // Call ChangeSettings method to apply settings
            ChangeSettings(e);

            #region Add user settings passed to their relevent property and save
            Properties.Settings.Default.BackColor          = e.BackColor;
            Properties.Settings.Default.SuggestedTileColor = e.SuggestedTileColor;
            Properties.Settings.Default.PossibleTilesColor = e.PossibleTilesColor;
            Properties.Settings.Default.ForeColor          = e.ForeColor;
            Properties.Settings.Default.SecForeColor       = e.SecForeColor;
            Properties.Settings.Default.Font = e.Font;
            Properties.Settings.Default.Save();
            #endregion
        }
Exemplo n.º 3
0
        /// <summary>
        /// Passes the settings in order to apply
        /// </summary>
        public void ApplySettings()
        {
            #region Set values for settings
            SettingsEventArgs settings = new SettingsEventArgs()
            {
                BackColor          = selectedBackColor,
                SuggestedTileColor = selectedSugTileColor,
                PossibleTilesColor = selectedPosTilesColor,
                ForeColor          = selectedForeColor,
                SecForeColor       = selectedSecForeColor,
                Font = selectedFont
            };
            #endregion

            // Invoke the custom event
            OnSettingsChanged.Invoke(this, settings);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Populates the puzzle and apply settings on load
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Call Populate method
            Populate();

            #region Get user settings
            SettingsEventArgs settings = new SettingsEventArgs()
            {
                BackColor          = Properties.Settings.Default.BackColor,
                SuggestedTileColor = Properties.Settings.Default.SuggestedTileColor,
                PossibleTilesColor = Properties.Settings.Default.PossibleTilesColor,
                ForeColor          = Properties.Settings.Default.ForeColor,
                SecForeColor       = Properties.Settings.Default.SecForeColor,
                Font = Properties.Settings.Default.Font
            };
            #endregion

            // Call ChangeSettings method to apply the settings
            ChangeSettings(settings);
        }