private void btnLogin_Click(object sender, EventArgs e) { if (txtUserName.Visible) { var userId = _command.EnterCredentials(txtUserName.Text, txtPassword.Text); if (userId == null) { MessageBox.Show(@"Entered wrong username\password."); return; } HideUI(userId); } else { var token = _command.Login(); Hide(); //var form = new Buildings(token); var form2 = new Attack(token); form2.Show(); //form.Show(); } }
static void Main(string[] args) { //string[] array = new string[13] { "Attack", "509", "355", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0" }; var command = new LoginActions(); var token = command.Login(); if (args[0].Equals("Attack")) { Attack(token, args); } else if (args[0].Equals("Build")) { Build(args); } else { Console.WriteLine("Wrong command entered."); } }
public void Login(object param) { LoginVM viewModel = param as LoginVM; try { LoginActions.Login(viewModel.Users, viewModel.Username, viewModel.Password); switch (Utils.AuthUser.Type) { case "admin": Administrator adminWindow = new Administrator(); adminWindow.ShowDialog(); break; case "client": Client clientWindow = new Client(); clientWindow.ShowDialog(); break; case "employee": Employee employeeWindow = new Employee(); employeeWindow.ShowDialog(); break; case "none": Unauthenticated newUser = new Unauthenticated(); newUser.ShowDialog(); break; default: MessageBox.Show("Type not allowed."); break; } } catch (LoginException ex) { MessageBox.Show("Eroare la login: "******"Eroare", MessageBoxButton.OKCancel); } }