private void frmRWeb_Load(object sender, EventArgs e) { this.Size = new Size(331, 102); deskHeight = Screen.PrimaryScreen.Bounds.Height; deskWidth = Screen.PrimaryScreen.Bounds.Width; this.Location = new Point(deskWidth - this.Width, deskHeight - this.Height - 40); if (verificarInstancia.getPrevInstance()) { this.WindowState = FormWindowState.Maximized; this.Close(); } ejecucion.EventTimer(60, HideForm); try { if (transferencia.ComprobarAccesoInternet()) { ejecucion.EventTimer(300, StartMassiveUpdate); } } catch (Exception) { Application.ExitThread(); this.Close(); } btnMaximizar.Enabled = false; }
public void IniciarSesion() { if (trans.ComprobarAccesoInternet()) { Cliente cliente = new Cliente() { IdCliente = txtEmail.Text.ToString(), Contrasenia = txtPassword.Text.ToString() }; states = cliente.AuthenticateUser("RW_Security_authenticate_User"); if (states[0]) { if (states[1]) { if (ct.ComprobarExistenciaTablas(paths.PathUser)) { File.Delete(paths.PathUser); using (StreamWriter user = new StreamWriter(paths.PathUser, false)) user.WriteLine(txtEmail.Text.ToString().ToLower()); Application.Restart(); } else { using (StreamWriter user = new StreamWriter(paths.PathUser, false)) user.WriteLine(txtEmail.Text.ToString().ToLower()); Application.Restart(); } } else { MessageBox.Show("Tu cuenta no esta activada, por favor revisa tu correo. ", "Falla de activación", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("El usuario o contraseña es incorrecto. ", "Falla de autenticación", MessageBoxButtons.OK, MessageBoxIcon.Error); intentos++; if (intentos >= 3) { this.Size = new Size(526, 324); tlpCaptcha.Visible = true; btnIniciarSesion.Enabled = false; numeroTemporal = captcha.CargarCaptcha(picCaptcha).ToString(); captchaStateLocked = true; txtCaptcha.Focus(); } } } else { MessageBox.Show("No cuentas con acceso a internet, vuelve a intentarlo más tarde.", "Falla de red", MessageBoxButtons.OK, MessageBoxIcon.Error); } }