예제 #1
0
        private void btn_volver_Click(object sender, EventArgs e)
        {
            menu ventanaMenu = new menu();

            this.Close();
            ventanaMenu.Show();
        }
예제 #2
0
        private void btn_emp_Click(object sender, EventArgs e)
        {
            menu ventanaMenu = new menu();

            this.Hide();
            ventanaMenu.Show();
        }
예제 #3
0
        /// <summary>
        /// Check every icon to see if it is matched, by
        /// comparing its foreground color to its background color.
        /// If all of the icons are matched, the player wins
        /// </summary>
        private void CheckForWinner()
        {
            menu ventanaMenu = new menu();

            foreach (Control control in tableLayoutPanel1.Controls)
            {
                Label iconLabel = control as Label;
                if (iconLabel.Image != null)
                {
                    return;
                }
            }

            tableLayoutPanel1.Visible = false;

            String   nom     = textBox1.Text;
            String   segundo = seg.ToString();
            String   minuto  = min.ToString();
            String   hora    = hr.ToString();
            String   tiempoS = hora + ":" + minuto + ":" + segundo;
            DateTime tiempo  = Convert.ToDateTime(tiempoS);

            timer2.Enabled = false;
            MessageBox.Show("Ha hecho coincidir todos los iconos!", "Enhorabuena");

            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();
                var sql = "INSERT INTO [dbo].[Table](NOMBRE,TIEMPO) VALUES (@nom, @tiempo)";
                using (var cmd = new SqlCommand(sql, sqlCon))
                {
                    cmd.Parameters.AddWithValue("@nom", nom);
                    cmd.Parameters.AddWithValue("@tiempo", tiempo);
                    cmd.ExecuteNonQuery();
                }
            }

            this.Close();
            ventanaMenu.Show();
        }