Ejemplo n.º 1
0
        public static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");

            Console.WriteLine(div * 2);
            Console.WriteLine();

            ElementBuilder li = new ElementBuilder("li");

            li.AddAttribute("class", "nav");
            li.AddAttribute("id", "one");
            li.AddContent("Hello OOP");

            Console.WriteLine(li * 3);
            Console.WriteLine();

            string image = HTMLDispatcher.CreateImage("img.png", "sample img", "sample");
            string url = HTMLDispatcher.CreateURL("https:\\\\softuni.bg", "SoftUni", "SoftUni website");
            string input = HTMLDispatcher.CreateInput("text", "username", "student");

            Console.WriteLine(image);
            Console.WriteLine(url);
            Console.WriteLine(input);
        }
 public string CreateURL(string url, string title, string text)
 {
     ElementBuilder image = new ElementBuilder("URL");
     image.AddAttribute("href", url);
     image.AddAttribute("title", title);
     image.AddAttribute("text", text);
     return image.ToString();
 }
 public string CreateInput(string inputType, string name, string value)
 {
     ElementBuilder image = new ElementBuilder("input");
     image.AddAttribute("input", inputType);
     image.AddAttribute("name", name);
     image.AddAttribute("value", value);
     return image.ToString();
 }
 public string CreateImage(string imageSource,string alt, string title)
 {
     ElementBuilder image = new ElementBuilder("img");
     image.AddAttribute("src", imageSource);
     image.AddAttribute("alt", alt);
     image.AddAttribute("title", title);
     return image.ToString();
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            //Console.WriteLine(div * 2);
        }
Ejemplo n.º 6
0
        public static string CreateHyperlink(string url, string title, string text)
        {
            ElementBuilder hyperlink = new ElementBuilder("a");

            hyperlink.AddAttribute("url", url);
            hyperlink.AddAttribute("title", title);
            hyperlink.AddContent(text);
            return(hyperlink.ToString());
        }
Ejemplo n.º 7
0
        public static ElementBuilder CreateInput(string type = "button", string name = "name", string value = "")
        {
            ElementBuilder input = new ElementBuilder("input");
            input.AddAttribute("type", type);
            input.AddAttribute("name", name);
            input.AddAttribute("value", value);

            return input;
        }
Ejemplo n.º 8
0
        public static string CreateInput(string inputType, string nameValue, string titleValue)
        {
            ElementBuilder input = new ElementBuilder("input");

            input.AddAttribute("name", nameValue);
            input.AddAttribute("title", titleValue);

            return(input.ToString());
        }
Ejemplo n.º 9
0
        public static string CreateDiv(string id, string style, string content)
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", id);
            div.AddAttribute("style", style);
            div.AddContent(content);
            return(div.ToString());
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");
            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            //Console.WriteLine(div * 2);

        }
Ejemplo n.º 11
0
        public static string CreateInput(string type, string name, string value)
        {
            ElementBuilder input = new ElementBuilder("input");
            input.AddAtributes("type", type);
            input.AddAtributes("name", name);
            input.AddAtributes("value", value);

            return input.ToString();
        }
Ejemplo n.º 12
0
        public static string CreateURL(string url, string title, string text)
        {
            ElementBuilder a = new ElementBuilder("a");
            a.AddAtributes("href", url);
            a.AddAtributes("title", title);
            a.AddContent(text);

            return a.ToString();
        }
Ejemplo n.º 13
0
 static void Main(string[] args)
 {
     ElementBuilder element = new ElementBuilder("div");
     element.AddAttribute("id", "page");
     element.AddAttribute("class", "big");
     element.AddContent("<p>Hello</p>");
     Console.WriteLine(element);
     Console.WriteLine(element * 2);
 }
Ejemplo n.º 14
0
        public static ElementBuilder CreateUrl(string url, string title, string text)
        {
            ElementBuilder link = new ElementBuilder("a");
            link.AddAttribute("href", url);
            link.AddAttribute("title", title);
            link.AddContent(text);

            return link;
        }
Ejemplo n.º 15
0
        public static string CreateImage(string imgSrc, string alt, string title)
        {
            ElementBuilder img = new ElementBuilder("img", true);

            img.AddAttribute("src", imgSrc);
            img.AddAttribute("alt", alt);
            img.AddAttribute("title", title);
            return(img.ToString());
        }
Ejemplo n.º 16
0
        public static ElementBuilder CreateImage(string src, string alt, string title)
        {
            ElementBuilder image = new ElementBuilder("img", true);

            image.AddAttribute("src", src);
            image.AddAttribute("alt", alt);
            image.AddAttribute("title", title);

            return(image);
        }
Ejemplo n.º 17
0
        public static ElementBuilder CreateInput(string type, string name, string value)
        {
            ElementBuilder input = new ElementBuilder("input", true);

            input.AddAttribute("type", type);
            input.AddAttribute("name", name);
            input.AddAttribute("value", value);

            return(input);
        }
Ejemplo n.º 18
0
        public static ElementBuilder CreateURL(string url, string title, string text)
        {
            ElementBuilder urlTag = new ElementBuilder("a");

            urlTag.AddAttribute("href", url);
            urlTag.AddAttribute("title", title);
            urlTag.AddContent(text);

            return(urlTag);
        }
Ejemplo n.º 19
0
        public static string CreateURL(string hrefValue, string titleValue, string content)
        {
            ElementBuilder anchor = new ElementBuilder("a");

            anchor.AddAttribute("href", hrefValue);
            anchor.AddAttribute("title", titleValue);
            anchor.AddContent(content);

            return(anchor.ToString());
        }
        public static string CreateInput(string inputType, string name, string value)
        {
            ElementBuilder e = new ElementBuilder("input");

            e.AddAttribute("type", inputType);
            e.AddAttribute("name", name);
            e.AddAttribute("value", value);

            return(e.ToString());
        }
Ejemplo n.º 21
0
        public static ElementBuilder CreateImage(string src, string alt, string title)
        {
            ElementBuilder image = new ElementBuilder("img", true);

            image.AddAttribute("src", src);
            image.AddAttribute("alt", alt);
            image.AddAttribute("title", title);

            return image;
        }
        public static string CreateURL(string url, string title, string text)
        {
            ElementBuilder e = new ElementBuilder("a");

            e.AddAttribute("href", url);
            e.AddAttribute("title", title);
            e.AddContent(text);

            return(e.ToString());
        }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            ElementBuilder element = new ElementBuilder("div");

            element.AddAttribute("id", "page");
            element.AddAttribute("class", "big");
            element.AddContent("<p>Hello</p>");
            Console.WriteLine(element);
            Console.WriteLine(element * 2);
        }
Ejemplo n.º 24
0
        public static ElementBuilder CreateURL(string url, string title, string text)
        {
            ElementBuilder urlTag = new ElementBuilder("a");

            urlTag.AddAttribute("href", url);
            urlTag.AddAttribute("title", title);
            urlTag.AddContent(text);

            return urlTag;
        }
Ejemplo n.º 25
0
        public static string CreateImage(string srcValue, string altValue, string titleValue)
        {
            ElementBuilder img = new ElementBuilder("img");

            img.AddAttribute("src", srcValue);
            img.AddAttribute("alt", altValue);
            img.AddAttribute("title", titleValue);

            return(img.ToString());
        }
Ejemplo n.º 26
0
 static void Main(string[] args)
 {
     ElementBuilder div = new ElementBuilder("div");
     div.AddAttribute("id", "page");
     div.AddAttribute("class", "big");
     div.AddContent("<p>Hello</p>");
     Console.WriteLine(div * 2);
     Console.WriteLine(HTMLDispatcher.CreateImage("abv.bg", "abv"));
     Console.WriteLine(HTMLDispatcher.CreateUrl("abv.bg", "abv", "go to abv"));
     Console.WriteLine(HTMLDispatcher.CreateInput());
 }
Ejemplo n.º 27
0
        public static ElementBuilder CreateImage(string imageSource, string alt, string title = null)
        {
            ElementBuilder image = new ElementBuilder("img");
            image.AddAttribute("src", imageSource);
            image.AddAttribute("alt", alt);
            if (title != null)
            {
                image.AddAttribute("title", title);
            }

            return image;
        }
        public static string CreateImage(string imagSource, string alt, string title)
        {
            ElementBuilder element = new ElementBuilder("img");

            element.AddAttribute("src", imagSource);

            element.AddAttribute("alt", alt);

            element.AddAttribute("title", title);

            return(element.ToString());
        }
        public static string CreateImage(string imagSource, string alt, string title)
        {
            ElementBuilder element = new ElementBuilder("img");

            element.AddAttribute("src", imagSource);

            element.AddAttribute("alt", alt);

            element.AddAttribute("title", title);

            return element.ToString();
        }
Ejemplo n.º 30
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div * 2);
            Console.WriteLine(HTMLDispatcher.CreateImage("abv.bg", "abv"));
            Console.WriteLine(HTMLDispatcher.CreateUrl("abv.bg", "abv", "go to abv"));
            Console.WriteLine(HTMLDispatcher.CreateInput());
        }
Ejemplo n.º 31
0
 static void Main()
 {
     ElementBuilder b = new ElementBuilder("b");
     //div.Attributes.Add("id", "header");
     Console.WriteLine(b);
     Console.WriteLine(b*2);
     b.AddAttributes("id", "header");
     Console.WriteLine(b);
     b.AddAttributes("class", "menu");
     Console.WriteLine(b);
     b.AddContent("Text");
     Console.WriteLine(b);
 }
Ejemplo n.º 32
0
        static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div * 2);

            Console.WriteLine();
            Console.WriteLine(CreateImage("smiley.gif", "Smiley face", "Project 101"));
            Console.WriteLine(CreateURL("http://softuni.bg", "SoftUni hyperlink", "Better education"));
            Console.WriteLine(CreateInput("text", "fname", "Input tag"));
        }
Ejemplo n.º 33
0
        public static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");
            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div * 2);

            Console.WriteLine();

            Console.WriteLine(HTMLDispatcher.CreateImage("MyDocuments/Pictures", "Beach", "California"));
            Console.WriteLine(HTMLDispatcher.CreateURL("www.metallica.com", "Metallica", "Official Metallica Website"));
            Console.WriteLine(HTMLDispatcher.CreateInput("button", "login", "Enter"));
        }
Ejemplo n.º 34
0
        static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddElement("id", "page");
            div.AddElement("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div * 2);

            Console.WriteLine();

            Console.WriteLine(HTMLDispatcher.CreateImage("D:\\Picture\\image.jpg", "Preview not available", "Snimka"));
            Console.WriteLine(HTMLDispatcher.CreateInput("text", "inputText", "This is some text"));
            Console.WriteLine(HTMLDispatcher.CreateURL("www.abv.bg", "ABV mail", "Some text"));
        }
Ejemplo n.º 35
0
        public static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div * 2);

            Console.WriteLine();

            Console.WriteLine(HTMLDispatcher.CreateImage("MyDocuments/Pictures", "Beach", "California"));
            Console.WriteLine(HTMLDispatcher.CreateURL("www.metallica.com", "Metallica", "Official Metallica Website"));
            Console.WriteLine(HTMLDispatcher.CreateInput("button", "login", "Enter"));
        }
Ejemplo n.º 36
0
        static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");
            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            Console.WriteLine(div * 2);

            Console.WriteLine(HTMLDispatcher.CreateImage("https://softuni.bg/Content/images/software-university-logo.png",
                "SoftUni Logo", "THIS ... IS ... SOFTWARE UNIVERSITYYYYYY !!!!"));
            Console.WriteLine();

            string url = HTMLDispatcher.CreateURL("https://softuni.bg/", "SoftUni website", "Welcome to SoftUni");
            Console.WriteLine(url);
            Console.WriteLine();

            Console.WriteLine(HTMLDispatcher.CreateInput("comment", "StudentComment", "Enter your comment here"));
        }
Ejemplo n.º 37
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");
            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");

            Console.WriteLine(div);
            Console.WriteLine();
            Console.WriteLine(div * 2);
            Console.WriteLine();

            ElementBuilder image = HTMLDispatcher.CreateImage("https://softuni.bg/Content/design/logo.png", "Software University", "Software University");
            ElementBuilder url = HTMLDispatcher.CreateURL("https://softuni.bg", "Software University", "SoftUni");
            ElementBuilder input = HTMLDispatcher.CreateInput("text", "name", "1");

            Console.WriteLine(image);
            Console.WriteLine(url);
            Console.WriteLine(input);
        }
Ejemplo n.º 38
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");
            ElementBuilder a = new ElementBuilder("a");
            ElementBuilder li = new ElementBuilder("li");

            div.AddAtributes("class", "softuni");
            div.AddAtributes("onclick", "highlight();");

            a.AddAtributes("href", "http://softuni.bg");
            a.AddContent("Software University");
            div.AddContent(a.ToString());

            Console.WriteLine(div);

            Console.WriteLine(li * 2);

            Console.WriteLine(HTMLDispatcher.CreateImage("http://softuni.bg/img/logo.png", "softuni-logo", "logo"));
            Console.WriteLine(HTMLDispatcher.CreateURL("http://softuni.bg", "Software University", "The best university in Bulgaria"));
            Console.WriteLine(HTMLDispatcher.CreateInput("text", "address", "Sofia bul. Vasil Kynchew 26"));
        }
        public static void Main()
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");

            div.AddAttribute("class", "big");

            div.AddContent("<p>Hello</p>");

            Console.WriteLine(div * 2);

            Console.WriteLine();


            ElementBuilder li = new ElementBuilder("li");

            li.AddAttribute("class", "nav");

            li.AddAttribute("id", "one");

            li.AddContent("Hello OOP");


            Console.WriteLine(li * 3);

            Console.WriteLine();

            string image = HTMLDispatcher.CreateImage("img.png", "sample img", "sample");

            string url = HTMLDispatcher.CreateURL("https:\\\\softuni.bg", "SoftUni", "SoftUni website");

            string input = HTMLDispatcher.CreateInput("text", "username", "student");

            Console.WriteLine(image);

            Console.WriteLine(url);

            Console.WriteLine(input);
        }
Ejemplo n.º 40
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");

            Console.WriteLine(div);
            Console.WriteLine();
            Console.WriteLine(div * 2);
            Console.WriteLine();


            ElementBuilder image = HTMLDispatcher.CreateImage("https://softuni.bg/Content/design/logo.png", "Software University", "Software University");
            ElementBuilder url   = HTMLDispatcher.CreateURL("https://softuni.bg", "Software University", "SoftUni");
            ElementBuilder input = HTMLDispatcher.CreateInput("text", "name", "1");

            Console.WriteLine(image);
            Console.WriteLine(url);
            Console.WriteLine(input);
        }
Ejemplo n.º 41
0
        static void Main()
        {
            //test html element builder
            ElementBuilder div = new ElementBuilder("div");

            div.AddAttribute("id", "page");
            div.AddAttribute("class", "big");
            div.AddContent("<p>Hello</p>");
            div.IsSelfClosed = false;
            Console.WriteLine(div * 2);


            //test html dispatcher
            string myImage = HTMLDispatcher.CreateImage("image1.jpg", "test image", "test image");

            Console.WriteLine(myImage);
            string myLink = HTMLDispatcher.CreateURL("http://www.softuni.bg", "www.softuni.bg", "www.softuni.bg");

            Console.WriteLine(myLink);
            string myInput = HTMLDispatcher.CreateInput("submit", "submit", "Submit");

            Console.WriteLine(myInput);
        }
Ejemplo n.º 42
0
 public static ElementBuilder operator *(ElementBuilder currentElement, int count)
 {
     if (count < 1)
     {
         throw new ArgumentOutOfRangeException("Value for repeat must be at least 1 or greater.");
     }
     var newElement = new ElementBuilder(currentElement.Tag)
     {
         Attributes = currentElement.Attributes,
         Content = currentElement.Content
     };
     newElement.Repeat *= count;
     newElement.IsSelfClosingTag = currentElement.IsSelfClosingTag;
     return newElement;
 }