private void _login_Click(object sender, EventArgs e) { // Input verification if (this._server.SelectedItem == null) { MessageBox.Show("You're required to select a server before authenticating.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this._account.Text.Trim().Length == 0) { MessageBox.Show("You're required to enter your account name before authenticating.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this._password.Text.Trim().Length == 0) { MessageBox.Show("You're required to enter your password before authenticating.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // Create status dialog this._statusForm = new StatusForm(); this._statusForm.SetMessage("Initializing..."); // Connect Dimension dimension = (Dimension)this._server.SelectedItem; this._context.Connect(dimension.Name, this._account.Text, this._password.Text); // Show dialog DialogResult result = this._statusForm.ShowDialog(); this._statusForm = null; if (result == DialogResult.Abort) { this._context.Disconnect(); } }
private void _context_SelectCharacterEvent(Context context, SelectCharacterEventArgs args) { // Run this method locally if (this.InvokeRequired) { this.Invoke( new Handler <SelectCharacterEventArgs>(_context_SelectCharacterEvent), new object[] { context, args }); return; } // Early out if (args.Characters.Length == 0) { return; } if (this._statusForm == null) { return; } // Hide current form this._statusForm.DialogResult = DialogResult.OK; this._statusForm.Hide(); this._statusForm = null; this.Hide(); // Show character selection dialog this._selectionForm = new SelectionForm(context, args.Characters); DialogResult result = this._selectionForm.ShowDialog(); if (result == DialogResult.OK) { // Select character args.Character = this._selectionForm.Character; } else { // Return to authentication screen this.Show(); } this._selectionForm = null; }