Пример #1
0
        private static void CSS2()
        {
            const string FILE   = "c:/temp/index.html";
            var          style1 = StyleBuilder.CreateInstance().AddBackColor("red").Build();
            var          style2 = StyleBuilder.CreateInstance().AddColor("yellow").Build();
            var          style3 = StyleBuilder.CreateInstance().AddFontSize(2.5F).Build();
            var          style  = style1.Add(style2).Add(style3);
            var          div    = DivBuilder.CreateInstance("Hello from CMPS 253").AddStyle(style).Build();

            System.Console.WriteLine(style);
            System.Console.WriteLine(div);
            File.WriteAllText(FILE, div.ToString());
            Process.Start(FILE);
        }
Пример #2
0
        private static void CSS()
        {
            const string FILE = "c:/temp/index.html";

            var style = StyleBuilder.CreateInstance().AddBackColor("Blue").AddColor("yellow").AddColor("green").AddFontSize(42.5F).Build();
            var div   = DivBuilder.CreateInstance("Hello from CMPS 253").AddStyle(style).Build();

            File.WriteAllText(FILE, div.ToString());
            Process.Start(FILE);
            return;

            //to know the possiblities, this line replaces the two lines above it.
            DivBuilder.CreateInstance("Hello from CMPS 253").AddStyle(StyleBuilder.CreateInstance().AddBackColor("red").AddColor("yellow").AddColor("green").AddFontSize(2.5F).Build()).Build();

            System.Console.WriteLine(style);
            System.Console.WriteLine(div);
        }