// ## ---- 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);
}
}
}