/// <summary> /// Checks if the results of the sweep fits the leaderboards through calls to SwpMngr. /// </summary> /// <returns>sweepFits (bool). </returns> private bool CheckSweepResult() { int time = Int32.Parse(lblTimer.Text); bool sweepFits = SwpMngr.TestNewSweep(time, CurrBoard.BS.SetDifficulty); return(sweepFits); }
/// <summary> /// Opens a EvalForm with a greeting for winning or losing, and the possibility to enter a name if /// qualified for leaderboard. /// Starts a new game if user choses "retry" or "do better". /// </summary> /// <param name="title">string.</param> /// <param name="msg">string.</param> /// <param name="button">string.</param> /// <param name="sweepFits">bool.</param> private void EvaluatePerformance(string title, string msg, string button, bool sweepFits) { EvalForm resultForm = new EvalForm(title, msg, button, sweepFits); DialogResult results = resultForm.ShowDialog(); if (sweepFits && results != DialogResult.Cancel) { string name = resultForm.GetName(); if (!String.IsNullOrEmpty(name)) { int time = Int32.Parse(lblTimer.Text); Difficulty diff = CurrBoard.BS.SetDifficulty; bool saveSuccess = SwpMngr.AddNewSweep(name, time, diff); if (!saveSuccess) { MessageBox.Show(SwpMngr.ErrorMsg, "File save error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else if (results == DialogResult.Retry) { StartNewGame(); } }