static IServerSouthwind Login(IServerSouthwind result) { Login milogin = new Login { Title = "Welcome to Southwind", UserName = Settings.Default.UserName, Password = "", ProductName = "Southwind", CompanyName = "Signum Software" }; milogin.LoginClicked += (object sender, EventArgs e) => { try { result.Login(milogin.UserName, Security.EncodePassword(milogin.Password)); Settings.Default.UserName = milogin.UserName; Settings.Default.Save(); UserEntity.Current = result.GetCurrentUser(); if (UserEntity.Current.CultureInfo != null) Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(UserEntity.Current.CultureInfo.Name); // verificar el tiempo de expiracion var alerta = result.PasswordNearExpired(); if (alerta.HasText()) MessageBox.Show(alerta); milogin.DialogResult = true; } catch (IncorrectUsernameException ex) { milogin.Error = ex.Message; milogin.FocusUserName(); } catch (IncorrectPasswordException ex) { milogin.Error = ex.Message; milogin.FocusPassword(); } }; milogin.FocusUserName(); bool? dialogResult = milogin.ShowDialog(); if (dialogResult == true) { UserEntity user = result.GetCurrentUser(); UserEntity.Current = user; return result; } else { return null; } } //Login
public LoginWindowAutomationPeer(Login login) : base(login) { }