private void OK_Click(object sender, EventArgs e) { username = Usernametxt.Text; if (username != "") { if (File.Exists(path + Usernametxt.Text + ".xml")) { bool isValidUser = PasswordValidation(); if (isValidUser == false) { MessageBox.Show("Invalid Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Passwordtxt.Clear(); } else { ValidationPage(); } } else { MessageBox.Show("Invalid UserName", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Usernametxt.Clear(); Passwordtxt.Clear(); } } }
private void UserNametxt_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Verify_Account(); Passwordtxt.Focus(); } }
private void pictureBox2_Click(object sender, EventArgs e) { Emailtxt.Clear(); Passwordtxt.Clear(); EmailSendtxt.Clear(); Objecttxt.Clear(); bodytxt.Clear(); Filettxt.Clear(); }
/// <summary> /// Sets the focus on the first empty textbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { if (iptxt.Text == "") { iptxt.Focus(); } else if (uNametxt.Text == "") { uNametxt.Focus(); } else { Passwordtxt.Focus(); } }
async void LoginAppAsync(object sender, EventArgs args) { if (string.IsNullOrEmpty(Useridtxt.Text)) { await App.Current.MainPage.DisplayAlert("Empty Values", "Please enter User ID", "OK"); Useridtxt.Focus(); } else if (string.IsNullOrEmpty(Passwordtxt.Text)) { await App.Current.MainPage.DisplayAlert("Empty Values", "Please enter Password", "OK"); Passwordtxt.Focus(); } else { WebClient client = new WebClient(); string url = "http://192.168.182.122/WMS/login.php?user1=" + Useridtxt.Text + "&" + "pass1=" + Passwordtxt.Text; byte[] html = client.DownloadData(url); res = utf.GetString(html); if (res == "upX") { await App.Current.MainPage.DisplayAlert("Login Error", "Please Check User ID and Password", "OK"); } else { string json = res; var mydata = JObject.Parse(json); string Name = mydata["Username"].ToString(); string Position = mydata["UserID"].ToString(); // await App.Current.MainPage.DisplayAlert("Info", Name, "OK"); // await App.Current.MainPage.DisplayAlert("Info", Position, "OK"); Application.Current.MainPage = new NavigationPage(new Gridview()); } } }
public async void RegisterMethod() { if (string.IsNullOrWhiteSpace(this.Emailtxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Email.", "Accept"); return; } //Valida que el formato del correo sea valido bool isEmail = Regex.IsMatch(Emailtxt, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); if (!isEmail) { await Application.Current.MainPage.DisplayAlert("Advertencia", "El formato del correo electrónico es incorrecto, revíselo e intente de nuevo.", "OK"); return; } if (string.IsNullOrEmpty(this.Passwordtxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Password.", "Accept"); return; } if (string.IsNullOrEmpty(this.Nombretxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter nombre.", "Accept"); return; } if (string.IsNullOrEmpty(this.Edadtxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter edad.", "Accept"); return; } else { if (Edadtxt.Length != 2) { await Application.Current.MainPage.DisplayAlert("Advertencia", "Solo permite 2 digitos .", "OK"); return; } } this.isVisible = true; this.isRunning = true; this.isEnabled = true; this.isPassword = true; await Task.Delay(1000); // User Modelo var user = new User { Email = Emailtxt.ToLower(), Password = Passwordtxt.ToLower(), Nombre = Nombretxt.ToLower(), Edad = Edadtxt.ToLower(), Creation_Date = DateTime.UtcNow.Date }; await App.Database.SaveUserAsync(user); await Application.Current.MainPage.DisplayAlert("Datos guardados", "Bienvenido" + nombre.ToString(), "Acectar"); this.IsRunningTxt = false; this.IsVisibleTxt = false; this.IsEnabledTxt = true; await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); }
// Password page methods. public void EnterPassword(string Password) { Passwordtxt.Clear(); Passwordtxt.SendKeys(Password); }