示例#1
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     _settingsPack.Apply();
     _gameIsRunning = false;
     _gameLoopThread?.Abort();
     Application.ExitThread();
 }
示例#2
0
        public static SettingsPack LoadSettings()
        {
            SettingsPack sp = Settings.Default.SettingsPack;

            if (sp != null)
            {
                return(sp);
            }

            sp = new SettingsPack();
            sp.Apply();
            return(sp);
        }
示例#3
0
        private void ok_button_Click(object sender, EventArgs e)
        {
            bool isFieldSizeChanged = Settings.Default.SettingsPack.FieldSize != _settingsPack.FieldSize;

            if (isFieldSizeChanged &&
                MessageBox.Show("Это сбросит ваш прогресс, вы уверены что хотите изменить размер поля?",
                                "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)
            {
                return;
            }

            _settingsPack.Apply();
            if (Owner is MainForm o)
            {
                o.SettingsChanged();

                if (isFieldSizeChanged)
                {
                    o.NewGame();
                }
            }

            Close();
        }