private void LoginButton_Click(object sender, RoutedEventArgs e) { bool regVal = false, passVal = false; if (ValidateRegNo() == false) { RegNoInputStatus = "Invalid registration number"; } else { RegNoInputStatus = ""; regVal = true; } var roundInfo = Manager.GetRoundInfo(Password); if (roundInfo == null) { PasswordInputStatus = "Invalid password"; } else { passVal = true; PasswordInputStatus = ""; } if (regVal != true || passVal != true) { return; } Player player = new Player(RegNo.ToUpper()); GameSession.Initialize(player, roundInfo); Manager.PushToLog(LogEvents.Login, player.RegNo); (new MainWindow()).Show(); this.Close(); }