Пример #1
0
        protected override void RenderBeginTag(HtmlTextWriter writer)
        {
            //base.RenderBeginTag(writer);

            if (!Page.IsPostBack || (Page.IsPostBack && ShowOnPostBack))
            {
                string content = LOADING_TEMLATE;

                string imageUrl = String.Empty;
                if (String.IsNullOrEmpty(ImageUrl))
                {
                    imageUrl = ResourceHelper.GetWebResourceUrl(Page, LOADING_IMAGE_NAME);
                }
                else
                {
                    imageUrl = this.ResolveUrl(ImageUrl);
                }

                content = content.Replace("#LOADING_IMAGE_SRC#", imageUrl);

                writer.Write(content);
            }
        }
Пример #2
0
        /// <summary>
        /// 转化 CSS 的内容
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        private string ParseCssWebResourceUrls(string resourceContent)
        {
            Regex regex = new Regex("<%=WebResource\\(\".*\\.(gif|png)*\"\\)%>");

            foreach (Match match in regex.Matches(resourceContent))
            {
                string webResourceName = match.Value.Replace("<%=WebResource(\"", string.Empty).Replace("\")%>", string.Empty);
                resourceContent = resourceContent.Replace(match.Value, String.Format("\"{0}\"", ResourceHelper.GetWebResourceUrl(_site, webResourceName)));
            }
            return(resourceContent);
        }