The LoginEventArgs class used for the login event.
Inheritance: System.EventArgs
Ejemplo n.º 1
0
 /// <summary>
 /// Fires the login event.
 /// </summary>
 /// <param name="e">The <see cref="LoginEventArgs" /> for the event.</param>
 private void LoginEvent(LoginEventArgs e)
 {
     if (OnLoginEvent != null)
         OnLoginEvent(e);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Login event handler.
 /// </summary>
 /// <param name="e"><see cref="LoginEventArgs" /> for the event.</param>
 private void LoginEvent(LoginEventArgs e)
 {
     LoginResult result = e.Result;
     if (!result.Success)
     {
         MessageBox.Show("Failed to login!\n" + result.Result, "Login Failed",
                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
         SetState(true);
         return;
     }
     _log.Info("Login succeeded! Got result: " + result.Result);
     _user.SetName(result.RealName);
     _user.SetSessionID(result.SessionID);
     try
     {
         _log.Debug("Creating game thread.");
         _gameThread = new Thread(RunGame) {Name = "Game"};
         _log.Info("Starting game thread...");
         _gameThread.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error occurred while trying to launch the game, more info can be found in the application log.",
                         "Sharpcraft Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         _log.Error("Failed to launch Sharpcraft, " + ex.GetType() + " thrown.");
         _log.Error("ToString() => " + ex);
         _log.Error(ex.GetType() + ": " + ex.Message);
         _log.Error("Stack Trace:\n" + ex.StackTrace);
         CloseGame();
         SetState(true);
     #if DEBUG
         throw;
     #else
         Close();
     #endif
     }
 }