void LoginWithDialog(string text, bool register = false)
 {
     do
     {
         var loginForm = new LoginForm(register);
         loginForm.InfoText = text;
         if (loginForm.ShowDialog() == DialogResult.Cancel)
         {
             tasClientConnectCalled = false;
             client.RequestDisconnect();
             lbState.Text = "Login cancelled, press button on left to login again";
             return;
         }
         canRegister = loginForm.CanRegister;
         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);
     }
 }
示例#2
0
 public void Dispose()
 {
     Stop();
     tas.UnsubscribeEvents(this);
     spring.UnsubscribeEvents(this);
     springPaths.UnsubscribeEvents(this);
     Program.main.Downloader.UnsubscribeEvents(this);
     Program.main.paths.UnsubscribeEvents(this);
     tas.RequestDisconnect();
     pollTimer.Dispose();
     if (timer != null)
     {
         timer.Dispose();
     }
     pollTimer          = null;
     linkSpringieClient = null;
 }