Ejemplo n.º 1
0
        private static T ConvertStringArgument <T>(string paramName, string value)
        {
            object result;

            if (!ConversionUtil.TryFromString(typeof(T), value, out result))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
                                                          HelpersResources.Chart_ArgumentConversionFailed, typeof(T).FullName), paramName);
            }
            return((T)result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method to convert a string to a ChartImageFormat.
        /// The chart image needs to be normalized to allow for alternate names such as 'jpg', 'xpng' etc
        /// to be mapped to their appropriate ChartImageFormat.
        /// </summary>
        private static ChartImageFormat ConvertStringToChartImageFormat(string format)
        {
            object result;

            format = NormalizeFormat(format);
            if (!ConversionUtil.TryFromString(typeof(ChartImageFormat), format, out result))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
                                                          HelpersResources.Image_IncorrectImageFormat, format), "format");
            }
            return((ChartImageFormat)result);
        }