Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        void BindContent()
        {
            if (!string.IsNullOrEmpty(Style))
            {
                string control = Path.GetFileNameWithoutExtension(ControlFile);
                string css     = CssTxt(control);

                TemplateStyleHelper styleHelper = new TemplateStyleHelper();
                CssTextBox.Text = styleHelper.LoadCss(control, Style, css);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void edtSave_Click(object sender, EventArgs e)
        {
            string newcss  = this.CssTextBox.Text;
            string control = Path.GetFileNameWithoutExtension(ControlFile);
            string css     = CssTxt(control);

            TemplateStyleHelper styleHelper = new TemplateStyleHelper();
            string finishStyle = styleHelper.ReplaceAppendCss(control, string.IsNullOrEmpty(Style) ? control.Replace(".", "_") : Style, Template, css, newcss);

            Write(control, finishStyle);

            doJs(string.IsNullOrEmpty(Style) ? control.Replace(".", "_") : Style);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新发布的样式
        /// </summary>
        /// <param name="style"></param>
        /// <param name="controlPath"></param>
        #region void UpdatePublishStyle(string style, string controlPath)
        private void UpdatePublishStyle(string style, string controlPath)
        {
            style = style.Replace(".", "_");
            string uxStyle = File.ReadAllText(PublishStyle, Encoding.UTF8);
            string css     = CssTxt(style, controlPath);
            string control = Path.GetFileNameWithoutExtension(controlPath);

            css = UpdateStyleImage(css, control, controlPath);
            TemplateStyleHelper styleHelper = new TemplateStyleHelper();

            css     = styleHelper.LoadCss(control, style, css);
            uxStyle = styleHelper.ReplaceAppendCss(control, style, GroupTemplate, uxStyle, css);
            File.WriteAllText(PublishStyle, uxStyle, Encoding.UTF8);
        }
Exemplo n.º 4
0
        public void SaveStyle()
        {
            try
            {
                OriginalTemplate.InitControls();

                SortControl();
                string   cssPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, We7TemplateStylePath);
                FileInfo cssfile = new FileInfo(cssPath);

                string csstxt = "";
                if (CheckFile(cssfile))
                {
                    using (StreamReader reader = OpenFile(cssfile.FullName))
                    {
                        csstxt = reader.ReadToEnd();
                    }
                }

                TemplateStyleHelper styleHelper = new TemplateStyleHelper();

                foreach (KeyValuePair <string, int> kvp in oldDic) //处理过期的控件样式
                {
                    string path    = kvp.Key.Split('_')[0];
                    string style   = kvp.Key.Split('_')[1];
                    string control = Path.GetFileNameWithoutExtension(path).Trim();
                    csstxt = styleHelper.DeleteStyle(control, style.Trim(), Path.GetFileNameWithoutExtension(FileName), csstxt);
                }

                foreach (KeyValuePair <string, int> kvp in newDic) //处理新增的控件样式
                {
                    string path  = kvp.Key.Split('_')[0];
                    string style = kvp.Key.Split('_')[1];
                    csstxt = styleHelper.AddStyleByPath(path, style.Trim(), Path.GetFileNameWithoutExtension(FileName), csstxt);
                }
                using (FileStream f = File.Open(cssPath, FileMode.Create, FileAccess.Write))
                {
                    using (StreamWriter writer = OpenWriteFile(f))
                    {
                        writer.Write(csstxt);
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void edtSaveAs_Click(object sender, EventArgs e)
        {
            string newStyle = Request.Form["NewStyleName"];

            if (!string.IsNullOrEmpty(newStyle))
            {
                newStyle = newStyle.Replace(".", "_");

                string newcss  = this.CssTextBox.Text.Replace(Style, newStyle);
                string control = Path.GetFileNameWithoutExtension(ControlFile);
                string css     = CssTxt(control);

                TemplateStyleHelper styleHelper = new TemplateStyleHelper();
                css = css + styleHelper.CreateAppendCss(control, newStyle, Group, newcss);
                Write(control, css);

                doJs(newStyle);
            }
        }