public ValidateResult Validate() { // Check properties. bool result = false; List <string> errorList = new List <string>(); if (TenantName == "") { errorList.Add("Enter the Tenant Name."); } else if (!TenantName.EndsWith(".onmicrosoft.com")) { errorList.Add("Format of Tenant Name is invalid.\ne.g. contoso.onmicrosoft.com"); } else if (!Util.IsValidUrl("https://login.windows.net/" + TenantName)) { errorList.Add("Format of Tenant Name is invalid.\ne.g. contoso.onmicrosoft.com"); } if (ClientID == "") { errorList.Add("Enter the Client ID."); } if (RedirectUri == "") { errorList.Add("Enter the Redirect URL."); } else if (!Util.IsValidUrl(RedirectUri)) { errorList.Add("Format of Redirect URL is invalid."); } if (errorList.Count == 0) { result = true; } return(new ValidateResult() { IsValid = result, ErrorMessage = errorList.ToArray() }); }