private void AuthenticationViewModel_SignInConfirmed(User user) { _currentUser = user; _dialogResult = 1; _authenticationWindow.Close(); AuthenticationCompleted(); }
private void LoginExecute(object obj) { currentEmployee.password = (obj as PasswordBox).Password; try { switch (currentEmployee.role) { case "admin": AdminMenu adminMenu = new AdminMenu(); authentication.Close(); adminMenu.ShowDialog(); break; case "employee": DAN_XLIII.View.Employee e = new DAN_XLIII.View.Employee(currentEmployee.id); authentication.Close(); e.ShowDialog(); break; case "manager": tblManager m = Service.Service.GetManagerById(currentEmployee.id); ManagerModify managerModify = new ManagerModify(currentEmployee.id); authentication.Close(); managerModify.ShowDialog(); break; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public bool Authenticate(ExtendedApplicationBase app) { AuthenticationWindow loadingWindow = new AuthenticationWindow(); loadingWindow.Show(); var account = app.Properties[app.PROPERTY_ACCOUNT]; var password = app.Properties[app.PROPERTY_PASSWORD]; if (account == null || password == null) { loadingWindow.Close(); return(false); } if (Authenticate(account.ToString(), password.ToString())) { //1. 获取用户信息 UserWorkRequest request = new UserWorkRequest(); var identity = new Identity(account.ToString(), true); app.Context.User = new Principal(request, identity); Thread.Sleep(5000); loadingWindow.Close(); return(true); } loadingWindow.Close(); return(false); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); AuthenticationWindow authWindow = new AuthenticationWindow(); AuthenticationViewModel authWindowViewModel = new AuthenticationViewModel(); authWindow.DataContext = authWindowViewModel; authWindowViewModel.LoginCompleted += (sender, args) => { MainWindow = new MainWindow(); MainWindow.Show(); authWindow.Close(); }; authWindow.ShowDialog(); }