private static string GetPrecipitation(Precipitation? precipitation, StrengthPrecipitation? strengthPrecipitation, bool isFog, bool isThunderstorm) { var sb = new StringBuilder(); sb.Append(GetPrecipitation(precipitation, strengthPrecipitation, sb.Length == 0)); sb.AppendFormat(GetThunderstorm(isThunderstorm, sb.Length == 0)); sb.Append(isFog ? GetEditedMessage(AppResource.WeatherData_Fog, sb.Length == 0) : string.Empty); return sb.ToString(); }
private static string GetPrecipitation(Precipitation? precipitation, StrengthPrecipitation? strengthPrecipitation, bool isFirst) { if (!precipitation.HasValue) return string.Empty; var result = GetStrengthPrecipitation(strengthPrecipitation, isFirst); switch (precipitation) { case Precipitation.Rain: return string.IsNullOrEmpty(result) ? AppResource.Precipitation_Rain : " {0}".F(AppResource.Precipitation_Rain.ToLower()); case Precipitation.Sleet: return string.IsNullOrEmpty(result) ? AppResource.Precipitation_Sleet : " {0}".F(AppResource.Precipitation_Sleet.ToLower()); case Precipitation.Snow: return string.IsNullOrEmpty(result) ? AppResource.Precipitation_Snow : " {0}".F(AppResource.Precipitation_Snow.ToLower()); } return string.Empty; }
private static string GetStrengthPrecipitation(StrengthPrecipitation? strengthPrecipitation, bool isFirst) { if (!strengthPrecipitation.HasValue) return string.Empty; switch (strengthPrecipitation) { case StrengthPrecipitation.Light: return GetEditedMessage(AppResource.StrengthPrecipitation_Light, isFirst); case StrengthPrecipitation.Heavy: return GetEditedMessage(AppResource.StrengthPrecipitation_Heavy, isFirst); } return string.Empty; }