Beispiel #1
0
        private void PreguntarSiActivo_Tick(object sender, EventArgs e)
        {
            PreguntarSiActivo.Interval = 5000;
            Process[] LoL = Process.GetProcessesByName("League of Legends");

            if (LoL.Length > 0)
            {
                SharkiQuerys.Obtener_Enemigos();

                if (!String.IsNullOrEmpty(SharkiQuerys._controlar_excepcion))
                {
                    PreguntarSiActivo.Stop();
                    MessageBox.Show("Es probable que el nombre de invocador introducido no coincida con el nombre de invocador de la " +
                                    "partida o que el modo de juego en el que se está jugando actualmente no esté implementado. ",
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    SharkiQuerys._controlar_excepcion = "";
                    this.Close();
                    Ventana.Show();
                    return;
                }
                else
                {
                    for (int i = 0; i < ImagenCampeon.Count(); i++)
                    {
                        ImagenCampeon[i].ImageLocation = "http://opgg-static.akamaized.net/images/lol/champion/"
                                                         + SharkiQuerys.Enemigos[i].Image.Full;
                    }

                    for (int j = 0; j < ImagenHechizos.Count(); j++)
                    {
                        ImagenHechizos[j].ImageLocation = "http://ddragon.leagueoflegends.com/cdn/6.24.1/img/spell/"
                                                          + SharkiQuerys.Hechizos[j].Image.Full;
                    }
                }

                this.Show();
                PreguntarSiActivo.Stop();
                PreguntarSiNOactivo.Start();
            }
        }
Beispiel #2
0
        // ## ---- Cerrar aplicación y efecto fade out --- #


        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(NombreInvocador.Text))
            {
                MessageBox.Show("No se ha introducido un nombre de invocador.",
                                "Nombre de invocador necesario.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (string.IsNullOrWhiteSpace(ApiKey.Text))
            {
                MessageBox.Show("Necesitas insertar el Key API generado en la página oficial de Riot.",
                                "Key API necesaria.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                // Comprobar que la Key y el nombre de invocador funcionan => Dar acceso a la segunda ventana.
                if (SharkiQuerys.Comprobar_Conexion(ApiKey.Text, NombreInvocador.Text,
                                                    (RiotSharp.Misc.Region)Enum.Parse(typeof(RiotSharp.Misc.Region), Servidor.SelectedValue.ToString())))
                {
                    // Abrir
                    Settings.Default["Invocador"] = NombreInvocador.Text;
                    Settings.Default["Key"]       = ApiKey.Text;
                    Settings.Default.Save();

                    InGame Ventana = new InGame();
                    hide = true;
                    FadeOut.Start();


                    Ventana.Show();
                }
                else
                {
                    MessageBox.Show("No es posible establecer la conexión, es probable que la API KEY" +
                                    " introducida sea inválida, haya caducado o exista algún problema con el servidor.",
                                    "API Key erronea.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }