Ejemplo n.º 1
0
	    void LoginWithDialog(string text)
		{
			do
			{
                var loginForm = new LoginForm();
				loginForm.InfoText = text;
			    //loginForm.Parent = this;
                if (loginForm.ShowDialog() == DialogResult.Cancel) 
				{
			        DoLogout();
					return;
				}
				Program.Conf.LobbyPlayerName = loginForm.LoginValue;
				Program.Conf.LobbyPlayerPassword = loginForm.PasswordValue;
				if (string.IsNullOrEmpty(Program.Conf.LobbyPlayerName) || string.IsNullOrEmpty(Program.Conf.LobbyPlayerPassword)) MessageBox.Show("Please fill player name and password", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
			} while (string.IsNullOrEmpty(Program.Conf.LobbyPlayerName) || string.IsNullOrEmpty(Program.Conf.LobbyPlayerPassword));
			Program.SaveConfig();
    	    client.Login(Program.Conf.LobbyPlayerName, Program.Conf.LobbyPlayerPassword);
		}
Ejemplo n.º 2
0
 private void LoginWithDialog(string text) {
     do
     {
         var loginForm = new LoginForm();
         loginForm.InfoText = text;
         if (loginForm.ShowDialog(Program.MainWindow) == DialogResult.Cancel)
         {
             tasClientConnectCalled = false;
             client.RequestDisconnect();
             lbState.Text = "Login cancelled, press button on left to login again";
             return;
         }
         Program.Conf.LobbyPlayerName = loginForm.LoginValue;
         Program.Conf.LobbyPlayerPassword = loginForm.PasswordValue;
         if (string.IsNullOrEmpty(Program.Conf.LobbyPlayerName) || string.IsNullOrEmpty(Program.Conf.LobbyPlayerPassword)) MessageBox.Show("Please fill player name and password", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     } while (string.IsNullOrEmpty(Program.Conf.LobbyPlayerName) || string.IsNullOrEmpty(Program.Conf.LobbyPlayerPassword));
     Program.SaveConfig();
     if (canRegister) client.Register(Program.Conf.LobbyPlayerName, Program.Conf.LobbyPlayerPassword);
     else client.Login(Program.Conf.LobbyPlayerName, Program.Conf.LobbyPlayerPassword);
 }