private void OnClientAuthResult(AuthResult ar, string msg) { client.ConnectionResult -= OnClientConnectionResult; client.AuthResult -= OnClientAuthResult; loginDialog.InvokeAsync(() => { loginDialog.EnableControls(true); if (ar != AuthResult.Accepted) { var desc = ar.GetDescription(); msg = msg == "" ? desc : String.Format("{0}: {1}", desc, msg); var err = ar == AuthResult.InvalidLogin ? LoginDialog.Error.Password : LoginDialog.Error.Generic; loginDialog.ShowError(err, msg); } else { loginDialog.Hide(); var request = new ClUserlistRequest(); client.Send(request); } }); }