string getImagePath(Type type, string name, string ext, Toolbar toolbar) { var folder = toolbar.ButtonImagesFolder; var result = ToolkitResourceManager.GetImageHref("HtmlEditor." + name + "." + ext, this); if (folder.Length > 0) { var path = folder + name + "." + ext; var fileName = String.Empty; if (IsDesign && _designer != null) { fileName = _designer.MapPath(path); } else { fileName = HttpContext.Current.Server.MapPath(path); } if (fileName != null) { if (File.Exists(fileName)) { result = path; } } } return(result); }
internal string getClientCSSPath(string pathN, string name) { var result = String.Empty; var fileName = String.Empty; var pathExists = false; var path = (pathN.Length > 0) ? LocalResolveUrl(pathN) : String.Empty; if (path.Length > 0) { try { fileName = HttpContext.Current.Server.MapPath(path); if (File.Exists(fileName)) { pathExists = true; } } catch { } } if (pathExists) { result = path; } else { result = ResolveClientUrl(ToolkitResourceManager.GetStyleHref("HtmlEditor." + name, this)); } return(result); }
public void BaseStyleInDerivedClassLinkGeneration() { var testCalendar = new TestCalendar(); var testCalendarStyleHref = ToolkitResourceManager.GetStyleHref(new ToolkitResourceManager.ResourceEntry("Calendar", testCalendar.GetType().BaseType, 0), testCalendar, TestGetWebResourceUrl); Assert.AreEqual("ToolkitHash.AjaxControlToolkit.Styles.Calendar.min.css", testCalendarStyleHref); }
public void BaseStyleLinkGeneration() { var calendar = new CalendarExtender(); var calendarStyleHref = ToolkitResourceManager.GetStyleHref(new ToolkitResourceManager.ResourceEntry("Calendar", calendar.GetType(), 0), calendar, TestGetWebResourceUrl); Assert.AreEqual("ToolkitHash.AjaxControlToolkit.Styles.Calendar.min.css", calendarStyleHref); }
public void DerivedStyleLinkGeneration() { var testCalendar = new TestCalendar(); var testCalendarStyleHref = ToolkitResourceManager.GetStyleHref(new ToolkitResourceManager.ResourceEntry("MyCalendar", testCalendar.GetType(), 0), testCalendar, TestGetWebResourceUrl); Assert.AreEqual("CustomHash.MyCalendar.min.css", testCalendarStyleHref); }
static void CreateStyleBundle(string bundleName) { if (String.IsNullOrWhiteSpace(bundleName)) { BundleTable.Bundles.Add(new StyleBundle("~/Content/AjaxControlToolkit/Styles/Bundle", Constants.CdnPrefix + "Content/AjaxControlToolkit/Styles/Bundle.css") .Include(ToolkitResourceManager.GetStylePaths())); } else { BundleTable.Bundles.Add(new StyleBundle("~/Content/AjaxControlToolkit/Styles/" + bundleName + "Bundle") .Include(ToolkitResourceManager.GetStylePaths(bundleName))); } }
static void CreateScriptBundle(string bundleName) { if (String.IsNullOrWhiteSpace(bundleName)) { BundleTable.Bundles.Add(new ScriptBundle("~/Scripts/AjaxControlToolkit/Bundle", Constants.CdnPrefix + "Scripts/AjaxControlToolkit/Bundle.js") .Include(ToolkitResourceManager.GetScriptPaths())); } else { BundleTable.Bundles.Add(new ScriptBundle("~/Scripts/AjaxControlToolkit/" + bundleName + "Bundle") .Include(ToolkitResourceManager.GetScriptPaths(bundleName))); } }
static void Main(string[] args) { var scriptBundle = new ScriptBundle("~/ScriptsBundle").Include(ToolkitResourceManager.GetScriptPaths()); var styleBundle = new StyleBundle("~/StylesBundle").Include(ToolkitResourceManager.GetStylePaths()); BundleTable.VirtualPathProvider = new VirtualPathProviderImpl(); BundleTable.Bundles.Add(scriptBundle); BundleTable.Bundles.Add(styleBundle); var context = new BundleContext(CreateHttpContext(), BundleTable.Bundles, String.Empty); File.WriteAllText("../AjaxControlToolkit.StaticResources/Scripts/Bundle.js", scriptBundle.GenerateBundleResponse(context).Content); File.WriteAllText("../AjaxControlToolkit.StaticResources/Styles/Bundle.css", styleBundle.GenerateBundleResponse(context).Content); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (CssPath.Length == 0) { CssPath = ResolveClientUrl(ToolkitResourceManager.GetStyleHref(Constants.HtmlEditorAttachedTemplatePopupName, this)); } if (_contentTemplate != null) { var c = new Control(); _contentTemplate.InstantiateIn(c); Content.Add(c); } }
public static void Start() { if (ToolkitConfig.UseStaticResources) { ToolkitResourceManager.RegisterScriptMappings(null); } CreateScriptBundle(null); CreateStyleBundle(null); var bundleResolver = new AjaxControlToolkit.Bundling.BundleResolver(new AjaxControlToolkit.Bundling.DefaultCache()); foreach (var bundleName in bundleResolver.GetControlBundles()) { if (ToolkitConfig.UseStaticResources) { ToolkitResourceManager.RegisterScriptMappings(bundleName); } CreateScriptBundle(bundleName); CreateStyleBundle(bundleName); } }