Exemplo n.º 1
0
        private void BtnContinuar_Click(object sender, EventArgs e)
        {
            var continuar = new Tela5();

            continuar.ShowDialog();
            this.Close();
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms.OfType <Tela5>().Count() > 0)
     {
         Form Jogo = Application.OpenForms["Tela5"];
         Jogo.Show();
         this.Hide();
     }
     else
     {
         Form Jogo = new Tela5();
         Jogo.Show();
         this.Hide();
     }
 }
Exemplo n.º 3
0
        private void btnOpenInformations_Click(object sender, EventArgs e)
        {
            if (Arma0.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 1";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma1.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 2";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma2.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 3";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma3.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 4";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma4.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 5";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma5.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 6";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma6.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 7";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma7.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 8";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma8.Checked == true)
            {
                {
                    SqlConnection conectar  = new SqlConnection(acesso);
                    string        pesquisar = "SELECT *FROM Pistolas WHERE Codigo = 9";
                    try
                    {
                        SqlCommand cmd = new SqlCommand(pesquisar, conectar);
                        conectar.Open();
                        SqlDataReader ler = cmd.ExecuteReader();
                        if (ler.Read() == true)
                        {
                            txtDanoMax.Text      = ler["Dano"].ToString();
                            txtDanoMin.Text      = ler["Alcance"].ToString();
                            txtTempoRecarga.Text = ler["Cadencia"].ToString();
                            txtPrecisaoC.Text    = ler["Precisao com Mira"].ToString();
                            txtRecuo.Text        = ler["Precisao sem Mira"].ToString();
                            txtPente.Text        = ler["Capacidade do Pente"].ToString();
                        }
                        conectar.Close();
                    }
                    catch (SqlException erro)
                    {
                        MessageBox.Show("Acesso negado!" + erro);
                    }
                }
            }

            if (Arma9.Checked == true)
            {
                Tela5 t5 = new Tela5(); t5.Show();
            }

            if (Arma10.Checked == true)
            {
                Tela5 t5 = new Tela5(); t5.Show();
            }
        }