Esempio n. 1
0
        /// <summary>
        /// Deletes the selected profile from the database.
        /// </summary>
        /// <param name="sender">The "Delete" button in profile managment.</param>
        /// <param name="e">Contains informations about the raised "click" event.</param>
        private void pic_Manage_Profile_Delete_Click(object sender, EventArgs e)
        {
            play_Sound_Click();

            frm_Confirmation confirmation = new frm_Confirmation("Voulez vous vraiment supprimer le profil: \n" + cbo_Manage_Profile_Name.SelectedItem.ToString());

            try
            {
                if (confirmation.ShowDialog(this) == DialogResult.OK)
                {
                    db_Link.Remove_Profile(cbo_Manage_Profile_Name.SelectedItem.ToString());

                    cbo_Manage_Profile_Name.Items.Clear();
                    populate_Profile_List();
                    reset_Stat_Board();

                    //Hides error
                    if (lbl_Manage_Profile_Fail.Visible == true)
                    {
                        lbl_Manage_Profile_Fail.Visible = false;
                    }
                }
            }
            catch (MySqlException ex)
            {
                if (ex.Number == 1042 | ex.Number == 0)
                {
                    lbl_Manage_Profile_Fail.Visible = true;
                }
            }
            confirmation.Dispose();
        }
Esempio n. 2
0
        /// <summary>
        /// Leaves the game without saving and close the application after raising confirmation form.
        /// </summary>
        /// <param name="sender">The "Leave" button in game.</param>
        /// <param name="e">Contains informations about the raised "click" event.</param>
        private void pic_Game_Close_Click(object sender, EventArgs e)
        {
            play_Sound_Click();

            frm_Confirmation confirmation = new frm_Confirmation("Voulez-vous vraiment quitter le jeu? Aucun changement ne sera enregistré.");

            if (confirmation.ShowDialog(this) == DialogResult.OK)
            {
                Close();
            }

            confirmation.Dispose();
        }
Esempio n. 3
0
        /// <summary>
        /// Leaves the game, doesn't save anything and brings back the main menu after raising confirmation form.
        /// </summary>
        /// <param name="sender">The "Menu" button in game.</param>
        /// <param name="e">Contains informations about the raised "click" event.</param>
        private void pic_Game_Menu_Click(object sender, EventArgs e)
        {
            play_Sound_Click();

            frm_Confirmation confirmation = new frm_Confirmation("Voulez-vous vraiment retourner au menu principal? Aucun changement ne sera enregistré.");

            if (confirmation.ShowDialog(this) == DialogResult.OK)
            {
                pnl_Game.Visible = false;
                pnl_Menu.Visible = true;

                reset_Game();

                is_In_Game = false;
                sound_Ended(music_Player, EventArgs.Empty); //Force sound switching
            }

            confirmation.Dispose();
        }