Exemplo n.º 1
0
        protected void UpdateSelectorValues(string activeConfigName)
        {
            FieldConfiguration config = FieldConfiguration.GetConfigurationByName(activeConfigName);

            if (config != null)
            {
                widthSelectionTextBox.Text  = config.Width.ToString();
                heightSelectionTextBox.Text = config.Height.ToString();
                minesSelectionTextBox.Text  = config.MinesCount.ToString();
            }
            else
            {
                widthSelectionTextBox.Text  = ConfigurationManager.CustomConfigWidth.ToString();
                heightSelectionTextBox.Text = ConfigurationManager.CustomConfigHeight.ToString();
                minesSelectionTextBox.Text  = ConfigurationManager.CustomConfigBombs.ToString();
            }
        }
Exemplo n.º 2
0
        protected void OnPresetComboBoxSelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox comboBoxSender = sender as ComboBox;

            if (comboBoxSender != null)
            {
                string selectedConfig = comboBoxSender.SelectedItem.ToString();
                if (selectedConfig.CompareTo(FieldConfiguration.CustomConfigString) != 0)
                {
                    DisableCustomSelectors();
                }
                else
                {
                    EnableCustomSelectors();
                }
                UpdateSelectorValues(comboBoxSender.SelectedItem.ToString());
                SelectedConfig = FieldConfiguration.GetConfigurationByName(selectedConfig);
                if (SelectedConfig == null)
                {
                    SelectedConfig = new FieldConfiguration(this.widthSelectionTextBox.Text, this.heightSelectionTextBox.Text, this.minesSelectionTextBox.Text);
                }
            }
        }