Пример #1
0
        /// <summary>
        /// 生成CSS字串
        /// </summary>
        /// <returns></returns>
        public string Build()
        {
            CssList = CssAdd.Except(CssRemove).ToList();
            var result = string.Join(" ", CssList);

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 生成CSS字串
        /// </summary>
        /// <returns></returns>
        public CssBuild Build()
        {
            var list = CssAdd.Except(CssRemove).ToList();

            CssList.Clear();
            CssList.AddRange(list);
            return(this);
        }
Пример #3
0
        /// <summary>
        /// 添加 css列表
        /// </summary>
        /// <param name="css"></param>
        /// <returns></returns>
        public CssBuild Add(IList <string> css, bool condition = true)
        {
            if (!condition)
            {
                return(this);
            }
            var list = CssAdd.Union(css).ToList();

            CssAdd.Clear();
            CssAdd.AddRange(list);
            return(this);
        }
Пример #4
0
        /// <summary>
        /// 开关 Css 项目
        /// </summary>
        /// <param name="css"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public CssBuild Toggle(IList <string> css, bool condition = true)
        {
            if (!condition)
            {
                return(this);
            }
            var cRemove = CssAdd.Intersect(css).ToList();
            var cAdd    = CssRemove.Intersect(css).ToList();

            CssAdd.AddRange(cAdd);
            CssRemove.AddRange(cRemove);
            return(this);
        }
Пример #5
0
 public CssBuild Reset()
 {
     CssAdd.Clear();
     CssRemove.Clear();
     return(this);
 }
Пример #6
0
 /// <summary>
 /// 添加 css列表
 /// </summary>
 /// <param name="css"></param>
 /// <returns></returns>
 public CssBuild Add(List <string> css)
 {
     CssAdd = CssAdd.Union(css).ToList();
     return(this);
 }