public override bool Authenticate(Control parent) { if (this.UseSocialLogin) { var dlg = new JabbRAuthDialog(this.Address, this.JanrainAppName); var result = dlg.ShowDialog(parent); if (result == DialogResult.Ok) { this.UserId = dlg.UserID; return true; } } else { var dialog = new ServerDialog(this, false, false); dialog.DisplayMode = DialogDisplayMode.Attached; var ret = dialog.ShowDialog(Application.Instance.MainForm); return ret == DialogResult.Ok; } return false; }
Control AuthButton () { var control = authButton = new Button { Text = "Authenticate" }; control.Click += delegate { var dlg = new JabbRAuthDialog(serverAddress.Text, janrainAppName.Text); dlg.DisplayMode = DialogDisplayMode.Attached; var result = dlg.ShowDialog (control); if (result == DialogResult.Ok) { server.UserId = dlg.UserID; SetVisibility (); } }; return control; }