private bool ValidateServerBox() { string server = txtServer.Text; if (string.IsNullOrWhiteSpace(server)) { ServerIsValid = null; return(false); } if (AddressBookEntry.IsValidServerEntry(server)) { ServerIsValid = true; return(true); } ServerIsValid = false; return(false); }
public AddressBookWindow(string currentServer, string currentPort) : this() { if (!string.IsNullOrWhiteSpace(currentServer) && !string.IsNullOrWhiteSpace(currentPort)) { string toCheck = string.Format("{0}:{1}", currentServer, currentPort); if (AddressBookEntry.IsValidServerEntry(toCheck)) { var existing = FindMatchingEntry(toCheck); if (existing != null) { txtName.Text = existing.Name; txtServer.Text = existing.Address; } else { txtServer.Text = toCheck; } txtName.Focus(); } } }