private void Window_ContentRendered(object sender, EventArgs e) { Controler a = Controler.Instance; pgb.Value += 1; Catalogue.Catalog b = Catalogue.Catalog.Instance; pgb.Value += 1; UI.Planning.Planning c = UI.Planning.Planning.Instance; pgb.Value += 1; Management.Management d = Management.Management.Instance; pgb.Value += 1; Sales.Sales f = Sales.Sales.Instance; pgb.Value += 1; LoginWindows LW = new LoginWindows(); this.Hide(); LW.ShowDialog(); this.Close(); }
//check login data and change windows if correct private void login(string user, string passMD5) { string in_user = user; string in_pass = passMD5; Controler ctrl = Controler.Instance; User cur_user = ctrl.getUser_byName(in_user); //check if password are equal if ((cur_user != null) && (cur_user.checkPass(in_pass))) { ctrl.setCurrentUser(cur_user); //hide the login windows this.Hide(); tb_password.Clear(); lb_error.Visibility = Visibility.Hidden; //create and show the dashboard windows Dashboard dashboardWindows = new Dashboard(); try { dashboardWindows.ShowDialog(); } catch {} //wait until we close the dashboard then show the login windows this.Show(); LoginWindows LW = new LoginWindows(); LW.Show(); this.Close(); } else { lb_error.Visibility = Visibility.Visible; lb_error.Text = "User or password incorrect"; } }