private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text.Length >= 5) { HighestScores hscObject = new HighestScores(txtName.Text, SaveScoresSettings.Point, SaveScoresSettings.Bonus, SaveScoresSettings.Missed, SaveScoresSettings.Time); hscObject.AddScores(); if (!hscObject.IsExist()) { hscObject.CreateFile(); } this.Close(); } else { MessageBox.Show("Name should be greater or equal 5", "WordJumble", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Playing_FormClosing(object sender, FormClosingEventArgs e) { if (Missed < ModeSettings.WrongTimesLimit) { DialogResult dg = MessageBox.Show("Are you wanna save to play after (by Lastest Play mode)?", "Word Jumble", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dg == DialogResult.Yes) { WordJumble.Properties.Settings.Default.Mode4Resume = PlayMode; ResumeSettings.SetUp(Point, Bonus, Missed, WinTimes, TotalWin, progBonus.Value, HintLimit, ChangeQuestionLimit, ReduceLimit); ResumeSettings.SaveSettings(); WordJumble.Properties.Settings.Default.ModeLastest = true; WordJumble.Properties.Settings.Default.Save(); } else { WordJumble.Properties.Settings.Default.ModeLastest = false; } } timeCount.Stop(); SaveScores scObject = new SaveScores(); HighestScores hscObject = new HighestScores(); if (Point > 5 && (hscObject.IsHighestScore(Point) || hscObject.IsTopTen() || !hscObject.IsExist())) { SaveScoresSettings.SetUp(TimeLimit, Point, Bonus, Missed); SaveScoresSettings.SaveSettings(); scObject.ShowDialog(); } }