private void SaveSettingsButton_Click(object sender, EventArgs e) { SettingsModel settingsToSave = new SettingsModel(); settingsToSave.Difficulty = Convert.ToInt32(DifficultyBox.Text); settingsToSave.Theme = ThemeBox.Text; settingsToSave.UserWord = PSymbolBox.Text; settingsToSave.ComputerWord = CSymbolBox.Text; GameTurn turn = GameTurn.Random; if (TPlayer.Checked) { turn = GameTurn.Player; } if (TRandom.Checked) { turn = GameTurn.Random; } if (TComputer.Checked) { turn = GameTurn.Computer; } settingsToSave.GameTurn = turn; File.WriteAllText("settings.json", JsonConvert.SerializeObject(settingsToSave)); this.Close(); MainMenuView.Show(); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { MainMenuView.Show(); if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
private void CancelSettingsButton_Click(object sender, EventArgs e) { this.Close(); MainMenuView.Show(); }