private bool _verifyInput() { if (TextBoxFrom.Text.Length == 0) { MessageBox.Show("Please input From, the format can be [email protected] or Tester<*****@*****.**>"); TextBoxFrom.Focus(); return(false); } if (ListViewTo.Items.Count == 0) { MessageBox.Show("Please add a recipient at least!"); ButtonAddRecipient.Focus(); return(false); } if (CheckBoxAuth.Checked && (TextBoxUser.Text.Length == 0 || TextBoxPassword.Text.Length == 0)) { MessageBox.Show("Please input user/password for authentication!"); TextBoxUser.Focus(); return(false); } return(true); }
public LoginWindow() { InitializeComponent(); if (Settings.Contains(Property.LastServer)) { TextBoxServer.Text = Settings.GetValue(Property.LastServer); } if (Settings.Contains(Property.LastUser)) { TextBoxUser.Text = Settings.GetValue(Property.LastUser); } if (Settings.Contains(Property.LastPassword)) { TextBoxPassword.Password = GetDecryptedPassword(); CheckBoxSavePassword.IsChecked = true; } if (Settings.Contains(Property.AutoConnect)) { CheckBoxAutoConnect.IsChecked = true; } if (TextBoxServer.Text != "" && TextBoxUser.Text != "" && TextBoxPassword.Password.Length == 0) { TextBoxPassword.SelectAll(); } else if (TextBoxServer.Text.Length == 0) { TextBoxServer.Select(0, 0); } else if (TextBoxUser.Text.Length == 0) { TextBoxUser.Select(0, 0); } }
public GRDialogPasswordExit() { InitializeComponent(); TextBoxUser.Focus(); }
} //Clave de Constructor: LogUser-C private void ClickMethod(object sender, EventArgs e) { ArrayControl = new Control[] { ButtonShowPassword, ButtonAccept, ButtonCancel, PictureClose }; for (; Index < ArrayControl.Length; Index++) { if (ArrayControl[Index] == sender) { break; } } switch (Index) { case 0: { TextBoxPassword.PasswordTextBox = (TextBoxPassword.PasswordTextBox.Equals('*')) ? '\0' : '*'; break; } case 1: { switch (OptionSession) { case (byte)TypeSession.LogIn: { Tabla1 = ObjValidations.LogSession(TypeModules.LogUser, TextBoxUser.TextTextBox.Trim(), TextBoxPassword.TextTextBox.Trim()); if (Tabla1 != null) { if (Tabla1.Rows.Count > 0) { ObjSession.NumControl = Tabla1.Rows[0]["NUMERO DE CONTROL"].ToString(); if (Tabla1.Rows[0]["NOMBRES"].ToString().Split(' ').Length.Equals(2)) { ObjSession.FirstName = Tabla1.Rows[0]["NOMBRES"].ToString().Split(' ')[0]; ObjSession.SecondName = Tabla1.Rows[0]["NOMBRES"].ToString().Split(' ')[1]; } else { ObjSession.FirstName = Tabla1.Rows[0]["NOMBRES"].ToString(); ObjSession.SecondName = string.Empty; } ObjSession.FirstLastName = (string.IsNullOrEmpty(Tabla1.Rows[0]["APELLIDO PATERNO"].ToString())) ? string.Empty : Tabla1.Rows[0]["APELLIDO PATERNO"].ToString(); ObjSession.SecondLastName = (string.IsNullOrEmpty(Tabla1.Rows[0]["APELLIDO MATERNO"].ToString())) ? string.Empty : Tabla1.Rows[0]["APELLIDO MATERNO"].ToString(); ObjSession.Sex = char.Parse(Tabla1.Rows[0]["SEXO"].ToString()); ObjSession.Password = Tabla1.Rows[0]["PASSWORD"].ToString(); ObjSession.Time = TimeSpan.Parse(Tabla1.Rows[0]["HORA"].ToString()); ObjSession.Date = DateTime.Parse(Tabla1.Rows[0]["FECHA"].ToString()); ObjSession.Permissions = char.Parse(Tabla1.Rows[0]["PERMISOS"].ToString()); Hide(); ObjPrincipal = new Principal(ObjSession); ObjPrincipal.Show(); } else { ObjAlerts.ShowDialog(); Index = 0; TextBoxUser.Focus(); TextBoxUser.SelectionStartTextBox = 0; TextBoxUser.SelectionLengthTextBox = TextBoxUser.TextTextBox.Length; } } else { ObjAlerts.ShowDialog(); Index = 0; TextBoxUser.Focus(); TextBoxUser.SelectionStartTextBox = 0; TextBoxUser.SelectionLengthTextBox = TextBoxUser.TextTextBox.Length; } break; } case (byte)TypeSession.LogOut: { if (TextBoxUser.TextTextBox.Equals(ObjSession.NumControl) && TextBoxPassword.TextTextBox.Equals(ObjSession.Password)) { Application.Exit(); } else { ObjAlerts.ShowDialog(); } break; } default: throw new Exception("Exception: LogUsers-CM", new IndexOutOfRangeException()); } break; } case 2: { TextBoxUser.TextTextBox = string.Empty; TextBoxPassword.TextTextBox = string.Empty; Index = 0; TextBoxUser.Focus(); break; } case 3: { if (OptionSession.Equals((byte)TypeSession.LogIn)) { Application.Exit(); } else if (OptionSession.Equals((byte)TypeSession.LogOut)) { if (Visible) { Hide(); } else { Show(); BringToFront(); } } break; } default: throw new Exception("Exception: LUCM", new IndexOutOfRangeException()); } Index = 0; } //Clave de Método: LogUser-CM