Esempio n. 1
0
        /// <summary>
        /// Convert a string representation into a null-able <seealso cref="FontStyle"/> object and return it.
        /// </summary>
        /// <param name="stringAttribName"></param>
        /// <param name="fontStyle"></param>
        /// <param name="converter"></param>
        /// <returns></returns>
        protected static FontStyle? ParseFontStyle(string stringAttribName, string fontStyle, FontStyleConverter converter)
        {
            if (string.IsNullOrEmpty(fontStyle))
            return null;

              try
              {
            return (FontStyle?)converter.ConvertFromInvariantString(fontStyle);
              }
              catch (Exception exp)
              {
            throw new Exception(string.Format(CultureInfo.InvariantCulture, "Invalid FontStyle attribute value '{0}'=\"{1}\"", stringAttribName, fontStyle), exp);
              }
        }