private void BtnOK_Click(object sender, EventArgs e) { var settings = new Settings { LiveForever = ChkLiveForever.Checked, ShowDebugInfo = ChkShowDebugInfo.Checked, NumOfEnemiesPerSecond = TbEnemyGenFreq.Value, FullScreen = ChkFullScreen.Checked, NumOfLasersPerSecond = TbLaserGenFreq.Value, BgmSoundEffect = ((BackgroundMusicItem)CbBackgroundMusic.SelectedItem).SoundEffect }; Settings.SaveSettings(settings); this.DialogResult = DialogResult.OK; Close(); }
public static void SaveSettings(Settings settings) { File.WriteAllText(SettingsFile, JsonConvert.SerializeObject(settings)); }