private void OKBtn_Click(object sender, EventArgs e) { bool okayToExit = true; if (!UseDefaultUserCreds()) { if (GetUsername().Length == 0) { okayToExit = false; } } if (okayToExit == true) { if (!UseDefaultUserCreds()) { credentialsControl.Username = ""; credentialsControl.Password = ""; } if (_plugin.GetContext() is Hostinfo) { //Hostinfo _hn = _plugin.GetContext(); } else { _plugin.SetContext(_plugin.GetContext()); } this.DialogResult = DialogResult.OK; this.Close(); } }