public async Task CheckValidityAsync(CallContext callContext) { await QueryValidationHelper.CheckUserExistsAsync(callContext.DbContext, UserId); if (CultureName != CultureName.Trim()) { throw new InvalidOperationException("Invalid Name: not trimmed"); } if (CultureName.Length < MinNameLength || CultureName.Length > MaxNameLength) { throw new InvalidOperationException($"Invalid culture name '{CultureName}'"); } }
private SupportedCultures() { foreach (string CultureName in Settings.Default.SupportedUICultures.Split(',')) { try { var CultureInfo = new CultureInfo(CultureName.Trim()); Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName)); } catch (Exception ex) { Debug.Print($"An exception occurred while adding the culture {CultureName} to the list of supported cultures. {ex.StackTrace}"); } } }
private SupportedCultures() { CultureInfo CultureInfo = default(CultureInfo); foreach (string CultureName in Settings.Default.SupportedUICultures.Split(',')) { try { CultureInfo = new CultureInfo(CultureName.Trim()); Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName)); } catch (Exception ex) { Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString())); } } }