/// <summary>
/// Constructor
/// </summary>
/// <param name="Pid">The player account ID</param>
public AccountEditForm(int Pid)
{
InitializeComponent();
this.AccountId = Pid;
// Register for Events
GpcmClient.OnSuccessfulLogin += GpcmClient_OnSuccessfulLogin;
GpcmClient.OnDisconnect += GpcmClient_OnDisconnect;
// Fill the account information boxes
using (GamespyDatabase Database = new GamespyDatabase())
{
Dictionary<string, object> User = Database.GetUser(AccountId);
PlayerID.Value = AccountId = Int32.Parse(User["id"].ToString());
AccountNick.Text = User["name"].ToString();
AccountEmail.Text = User["email"].ToString();
// Disable options if user is online
if (GamespyEmulator.IsPlayerConnected(AccountId))
{
SatusLabel.Text = "Online (IP: " + User["lastip"].ToString() + ")";
UpdateBtn.Enabled = false;
DeleteBtn.Enabled = false;
DisconnectBtn.Enabled = true;
}
else
{
SatusLabel.Text = "Offline";
}
}
}