internal Chart(HttpContextBase httpContext, VirtualPathProvider virtualPathProvider, int width, int height, string theme = null, string themePath = null) { Debug.Assert(httpContext != null); if (width < 0) { throw new ArgumentOutOfRangeException("width", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, 0)); } if (height < 0) { throw new ArgumentOutOfRangeException("height", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, 0)); } _httpContext = httpContext; _virtualPathProvider = virtualPathProvider; _width = width; _height = height; _theme = theme; // path must be app-relative in case chart is rendered from handler in different directory if (!String.IsNullOrEmpty(themePath)) { _themePath = VirtualPathUtil.ResolvePath(TemplateStack.GetCurrentTemplate(httpContext), httpContext, themePath); if (!_virtualPathProvider.FileExists(_themePath)) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, HelpersResources.Chart_ThemeFileNotFound, _themePath), "themePath"); } } }
internal Chart(HttpContextBase httpContext, Func <VirtualPathProvider> virtualPathProviderFunc, int width, int height, string theme = null, string themePath = null) { Contract.Assert(httpContext != null); Contract.Assert(virtualPathProviderFunc != null); // HostingEnvironment.VirtualPathProvider never null in running host but may change at any time. Contract.Assert(virtualPathProviderFunc() != null); if (width < 0) { throw new ArgumentOutOfRangeException("width", String.Format( CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, 0)); } if (height < 0) { throw new ArgumentOutOfRangeException("height", String.Format( CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, 0)); } _httpContext = httpContext; _virtualPathProviderFunc = virtualPathProviderFunc; _width = width; _height = height; _theme = theme; // path must be app-relative in case chart is rendered from handler in different directory if (!String.IsNullOrEmpty(themePath)) { _themePath = VirtualPathUtil.ResolvePath(TemplateStack.GetCurrentTemplate(httpContext), httpContext, themePath); if (!virtualPathProviderFunc().FileExists(_themePath)) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, HelpersResources.Chart_ThemeFileNotFound, _themePath), "themePath"); } } }