private void BTN_Exit_Click(object sender, EventArgs e) { Form Menu = new SongMenu(Database, Game); Menu.Show(); this.Dispose(); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form Load = new SongMenu(); SongMenu.OriginalForm = Load;//Saves the original form to dispose at the end Application.Run(Load); if (SongMenu.IsSongSelected) { Composition TSong = SongMenu.TSong; TDatabase Database = SongMenu.Data; using (Game1 game = new Game1(TSong, Database)) { game.Run(); } } }
private void BTN_TryAgain_Click(object sender, EventArgs e) { DialogResult MsgResult; if (!IsSaved) { MsgResult = MessageBox.Show("Would you like to save?", "Save Attempt?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (MsgResult == DialogResult.Yes) { IsSaved = true; Database.AddSongAttempt(TSong.SongName, TSong.Difficulty.ToString(), (int)Feedback.PercentageReturn, Feedback.GetGrade); } } TryAgain = true; Form Menu = new SongMenu(Database, Game); Menu.Show(); this.Dispose(); }
private void BTN_Login_Click(object sender, EventArgs e) { DialogResult MsgResult; string Output = "Username or Password is incorrect, please try again"; string ExitMsg = "Loadup Error"; Database.UpdateLoginCredentials(TXT_Username.Text, TXT_Password.Text); Database.FillStudentsTbl(); if (Database.ComparisonStudents()) { Form Menu = new SongMenu(Database); Menu.Show(); this.Dispose(); } else { MsgResult = MessageBox.Show(Output, ExitMsg, MessageBoxButtons.OK, MessageBoxIcon.Question); if (MsgResult == DialogResult.OK) { TXT_Password.Clear(); TXT_Username.Clear(); } } }