private void Button_Click(object sender, RoutedEventArgs e) { string Content = (e.Source as Button).Content.ToString(); if (Content == "管理员界面") { if (adminMainWindow.IsActive == false) { adminMainWindow = new AdminMainWindow(); } adminMainWindow.WindowStartupLocation = WindowStartupLocation.Manual; adminMainWindow.Left = 0; adminMainWindow.Top = 500; adminMainWindow.Show(); } else if (Content == "用户界面") { if (userMainWindow.IsActive == false) { userMainWindow = new UserMainWindow(); } userMainWindow.WindowStartupLocation = WindowStartupLocation.Manual; userMainWindow.Left = 800; userMainWindow.Top = 500; userMainWindow.Show(); } }
private void Back_Click(object sender, RoutedEventArgs e) { Window Window = new AdminMainWindow(); Window.Show(); Close(); }
// 根据用户类型,跳转对应界面 private Window JumpWindow(User user) { Window window; switch (user.type) { case Constant.USER_TYPE_ADMIN: window = new AdminMainWindow(); break; case Constant.USER_TYPE_ENGINEER: window = new EngineerMainWindow(); break; case Constant.USER_TYPE_MANAGER: window = new ManagerMainWindow(); break; default: window = new WorkerMainWindow(); break; } window.WindowStartupLocation = WindowStartupLocation.Manual; //使新窗口位置在原来的位置上 window.Left = this.Left; //使新窗口位置在原来的位置上 window.Top = this.Top; //使新窗口位置在原来的位置上 return(window); }
public override void Execute(object parameter) { //Ik weet dat deze oplossing voor de login niet is zoals in het voorbeeld. Ik heb voor deze optie gekozen omdat de methode van het voorbeeld ervoor zorgde dat mijn hele project ophield met werken. var passwordBox = parameter as PasswordBox; inlogwachtwoord = passwordBox.Password; gebruiker = Gebruikers.Where(x => x.Wachtwoord == inlogwachtwoord && x.Mail == inlogmail).SingleOrDefault(); if (gebruiker == null) { MessageBox.Show("De inloggegevens zijn ongeldig."); } else { MainWindow mainView = new MainWindow(); MainWindowViewModel mainViewModel = new MainWindowViewModel(mainView); mainView.DataContext = mainViewModel; mainView.Show(); if (gebruiker.GebruikerTypeID == 1) { AdminMainWindow AdminView = new AdminMainWindow(); AdminMainWindowViewModel AdminViewModel = new AdminMainWindowViewModel(AdminView); AdminView.DataContext = AdminViewModel; AdminView.Show(); } CloseWindow(window); } }
private void button1_Click(object sender, EventArgs e) { // DO TESTOW, COBY NIE MUSIEC CO CHWILE SIE LOGOWAC NA ADMINA AdminMainWindow adminMainWindow = new AdminMainWindow(); adminMainWindow.Show(); }
public void LogIn(int ids, string password, Login log) { Main.Instance.worker = DAO.GetProfileTable().GetProfileByLoginAndPassword(ids, password); locworker = Main.Instance.worker; switch (locworker.profileCategory.id) { case 1: ReaderMainWindow rm = new ReaderMainWindow(); rm.Show(); break; case 2: LibrarianMainWindow lm = new LibrarianMainWindow(); lm.Show(); break; case 3: AdminMainWindow ad = new AdminMainWindow(); ad.Show(); break; } log.Close(); }
private Window CreateAdminWindow() { ISimpleViewModelFactory simpleViewModelFactory = new AdminSimpleViewModelFactory(unitOfWork); INavigator navigator = new Navigator(simpleViewModelFactory); Window window = new AdminMainWindow { DataContext = new AdminMainViewModel(navigator) }; return(window); }
/// <summary> /// LogIn Button to the Caunselor System /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ClickLogInButton(object sender, RoutedEventArgs e) { try { string inputUserName = UserNameText.Text.ToUpper(); string inputPassword = PasswordText.Password.ToString(); string inputRole = RoleComboBox.Text; if (inputRole.Equals(REGULAR_USER_STRING)) { var adviceWindow = new AdviceMainWindow(); adviceWindow.Show(); this.Close(); } else { CheckInputLogInWindow(inputUserName, inputPassword, inputRole); string userFromDB = GetUserNameFromDB(inputUserName); string passwordFromDB = GetUserPasswordDB(inputUserName); string roleFromDB = GetRoleFromDB(inputUserName); if (inputRole.Equals(MASTER_STRING)) { inputRole = MASTER_CODE; } if (inputUserName.Equals(userFromDB) && inputPassword.Equals(passwordFromDB) && inputRole.Equals(roleFromDB)) { var admin = new AdminMainWindow(userFromDB); admin.Show(); this.Close(); } else { ErrorLebal.Content = "One of the values is incorrect!"; ErrorLebal.Visibility = Visibility.Visible; throw new Exception("One of the values is incorrect"); } } Logger.Instance.Info("ClickLogInButton()"); } catch (Exception ex) { Logger.Instance.Error("Error while tyring to click log in ", ex); } }
public void CanLoginBadWay() { IApp app = new App(); ILoginWindow loginWindow = new LoginWindow(); IWindow adminMainWindow = new AdminMainWindow(); IWindow userMainWindow = new MainWindow(); string login = GetTestParameter("login"); string password = GetTestParameter("password"); app.Launch(); loginWindow.LoginTextBox.Text = login; loginWindow.PasswordTextBox.Text = password; bool isAdmin = login.ToLower() == "admin"; if (isAdmin) { loginWindow.AdminLoginButton.Click(); DateTime start = DateTime.Now; while (!adminMainWindow.IsLoaded && (DateTime.Now - start).TotalSeconds < 5) { Thread.Sleep(100); } Assert.IsTrue(adminMainWindow.IsLoaded, "Admin Window was not loaded"); } else { loginWindow.LoginButton.Click(); DateTime start = DateTime.Now; while (!userMainWindow.IsLoaded && (DateTime.Now - start).TotalSeconds < 5) { Thread.Sleep(100); } Assert.IsTrue(userMainWindow.IsLoaded); } }