private void RefreshEnabledState(object sender, EventArgs e)
{
OKButton.Enabled = ((EndpointName.Text ?? "").Length > 0) &&
((Server.Text ?? "").Length > 0) &&
((Username.Text ?? "").Length > 0) &&
((Password.Text ?? "").Length > 0) &&
(
(SendToGroupChat.Checked && (ChatChannel.Text ?? "").Length > 0) ||
(SendToUser.Checked && (ToUsername.Text ?? "").Length > 0)
);
}