Exemple #1
0
        private string Header()
        {
            var sb = new StringBuilder();

            AddLine(sb, "  <meta name = 'viewport' content ='width=device-width;initial-scale = 1.0;'maximum-scale = 1.0;/>");
            AddLine(sb, "  <meta name = 'apple-mobile-web-app-capable' content = 'yes' />");
            AddLine(sb, string.Empty);
            AddLine(sb, HtmlLib.Comment("JQuery UI"));
            AddLine(sb, HtmlLib.CssLink("../css/jquery-ui-1.10.0.custom.min.css"));
            AddLine(sb, HtmlLib.CssLink("../css/base.css"));
            AddLine(sb, HtmlLib.CssLink("../css/tablet.css"));
            AddLine(sb, string.Empty);
            AddLine(sb, HtmlLib.Comment("Javascript"));
            AddLine(sb, HtmlLib.JSScriptFile("../js/jquery-1.8.2.min.js"));
            AddLine(sb, HtmlLib.JSScriptFile("../js/jquery-ui-1.10.0.custom.min.js"));
            AddLine(sb, string.Empty);
            AddLine(sb, HtmlLib.StyleOpen());
            AddLine(sb, "  .class1 A:link {text-decoration: yellow;}");
            AddLine(sb, "  .left.col {width: 250px;}");
            AddLine(sb, "  .right.col {left: 250px;right: 0;}");
            AddLine(sb, "  .header.row {height: 75px;	background: #333;}");
            AddLine(sb, "  .body.row {top: 75px;bottom: 50px;background: #000;padding: 1em;}");
            AddLine(sb, "  .footer.row {height: 75px;top: 20px;bottom: 0;background: #333;}");
            AddLine(sb, "  body {color: White;background: #000;font - family: Segoe UI, Helvetica, Arial, Sans-Serif;}");
            AddLine(sb, "  .header, .footer {padding: 0 1em;}");
            AddLine(sb, HtmlLib.StyleClose());
            AddLine(sb, string.Empty);
            AddLine(sb, HtmlLib.ScriptOpen());
            var script = @"
        $(function () {

            $('#myAccordian').accordion({
                header: 'h3',

				activate: false,
                heightStyle: 'fill',
                collapsible: true,
                autoHeight: false
			});
        });";

            AddLine(sb, script);
            AddLine(sb, HtmlLib.ScriptClose());

            return(sb.ToString());
        }
Exemple #2
0
        public void Render()
        {
            EnsureDirectory(_filename);

            var sw = new StreamWriter(_filename, false);

            sw.WriteLine(_header.Length > 0 ? HtmlLib.HTMLOpenPlus(_header) : HtmlLib.HTMLOpen());
            sw.WriteLine(HtmlLib.HeadOpen());

            //  Add the head parts
            var myEnumerator = _headList.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                sw.WriteLine($"   {myEnumerator.Current}");
            }

            sw.WriteLine("\t" + HtmlLib.HTMLTitle(_title));
            if (_cssFile != null)
            {
                if (_cssFile.Length > 0)
                {
                    sw.WriteLine("\t" + HtmlLib.CssLink(_cssFile));
                }
            }
            if (_script1 != null)
            {
                if (_script1.Length > 0)
                {
                    sw.WriteLine("\t" + HtmlLib.VBScriptFile(_script1));
                }
            }
            if (_script2 != null)
            {
                if (_script2.Length > 0)
                {
                    sw.WriteLine("\t" + HtmlLib.JSScriptFile(_script2));
                }
            }
            if (TopScripts != null)
            {
                RenderTopScripts(sw);
            }

            if (StyleList.Count > 0)
            {
                var styleEnumerator = StyleList.GetEnumerator();
                sw.WriteLine("\t" + HtmlLib.StyleOpen());
                while (styleEnumerator.MoveNext())
                {
                    sw.WriteLine("\t" + styleEnumerator.Current);
                }
                sw.WriteLine("\t" + HtmlLib.StyleClose());
            }

            sw.WriteLine(HtmlLib.HeadClose());
            sw.WriteLine(HtmlLib.BodyOpen());

            //sw.WriteLine(HtmlLib.DivOpen("id=\"container\""));

            //  Add the body parts
            myEnumerator = _bodyList.GetEnumerator();
            while (myEnumerator.MoveNext())
            {
                sw.WriteLine(myEnumerator.Current);
            }

            //sw.WriteLine(HtmlLib.DivClose());

            if (Scripts != null)
            {
                WriteScripts(sw);
            }
            sw.WriteLine(HtmlLib.BodyClose());
            sw.WriteLine(HtmlLib.HtmlClose());
            sw.Close();

            if (AnnounceIt)
            {
                Announce($"   {_filename} has been rendered");
            }
        }