Beispiel #1
0
    static void Main()
    {
        Console.WriteLine("Please add the name of the element you want to create:");
        string         name    = Console.ReadLine();
        ElementBuilder element = new ElementBuilder(name);

        Console.WriteLine("You created the element " + element.Element);
        string value;

        while (true)
        {
            Console.WriteLine("Would you like to enter an attribute? Y/N");
            string checker = Console.ReadLine();
            if (checker == "N" || checker == "n")
            {
                break;
            }
            Console.WriteLine("Please enter the attribute type");
            string attribute = Console.ReadLine();
            Console.WriteLine("Please enter the attribute value");
            value = Console.ReadLine();
            element.AddAttribute(attribute, value);
        }
        Console.WriteLine("The current element is " + element.Element);
        Console.WriteLine("Please add content or press enter to continue. Please note you can't add content if it has already been set:");
        string content = Console.ReadLine();

        element.AddContent(content);
        Console.WriteLine("The current element is " + element.Element);
        Console.WriteLine("How many times do you want to print the element?");
        uint multiplier = uint.Parse(Console.ReadLine());

        Console.WriteLine(element * multiplier);
        Console.WriteLine("Now we are creating an img tag. Please enter img source:");
        string source = Console.ReadLine();

        Console.WriteLine("Please enter img alt:");
        string alt = Console.ReadLine();

        Console.WriteLine("Please enter img title:");
        string title = Console.ReadLine();

        Console.WriteLine(HTMLDispatcher.CreateImage(source, alt, title));
        Console.WriteLine("Now we are creating URL. Please enter the link:");
        source = Console.ReadLine();
        Console.WriteLine("Please enter the text:");
        string text = Console.ReadLine();

        Console.WriteLine("Please enter title:");
        title = Console.ReadLine();
        Console.WriteLine(HTMLDispatcher.CreateURL(source, text, title));
        Console.WriteLine("Now we are creating input. Please enter input type:");
        string type = Console.ReadLine();

        Console.WriteLine("Please enter input name:");
        name = Console.ReadLine();
        Console.WriteLine("Please enter input value:");
        value = Console.ReadLine();
        Console.WriteLine(HTMLDispatcher.CreateInput(type, name, value));
    }
Beispiel #2
0
    public static void Main()
    {
        // create elements using static methods trough HTMLDispatcher class
        Console.WriteLine(HTMLDispatcher.CreateImage("pics/logo.png", "site logo", "resizable"));
        Console.WriteLine();

        Console.WriteLine(HTMLDispatcher.CreateURL("site.com", "Site link", "Click here"));
        Console.WriteLine();

        Console.WriteLine(HTMLDispatcher.CreateInput("radio", "group", "married"));
        Console.WriteLine();

        // create elements with ElementBuilder class instance 
        ElementBuilder div = new ElementBuilder("div");

        div.AddAttribute("class", "clearfix");
        div.AddAttribute("id", "homebox");
        div.AddContent("Text goes here.");
        div.AddContent(" More text added here.");

        Console.WriteLine(div.ToString());
        Console.WriteLine();

        Console.WriteLine(div * 2);
    }
Beispiel #3
0
    public static string CreateImage(string imageSource, string alt, string title)
    {
        HTMLDispatcher el = new HTMLDispatcher("img");
            el.addAtribute("href=\"" + imageSource + "\"");
            el.addAtribute("alt=\"" + alt + "\"");
            el.InnerElement = title;

            return el.HTMLElement;
    }
Beispiel #4
0
    public static string CreateImage(string imageSource, string alt, string title)
    {
        HTMLDispatcher el = new HTMLDispatcher("img");

        el.addAtribute("href=\"" + imageSource + "\"");
        el.addAtribute("alt=\"" + alt + "\"");
        el.InnerElement = title;

        return(el.HTMLElement);
    }
    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://www.google.bg/images/srpr/logo11w.png", "google", "search"));
        Console.WriteLine(HTMLDispatcher.CreateURL("https://www.google.bg/images/srpr/logo11w.png", "google", "search"));
        Console.WriteLine(HTMLDispatcher.CreateInput("submit", "google", "search"));
    }
Beispiel #6
0
    static void Main()
    {
        ElementBuilder div = new ElementBuilder("div");

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

        Console.WriteLine(HTMLDispatcher.CreateImage("imageS.jpg", "test s", "selfi"));
        Console.WriteLine(HTMLDispatcher.CreateInput("submit", "Submit", "text"));
        Console.WriteLine(HTMLDispatcher.CreateURL("https://softuni.bg/", "www.softuni.bg", "softuni.bg"));
    }
Beispiel #7
0
    static void Main(string[] args)
    {
        HTMLDispatcher htmlElementDiv = new HTMLDispatcher();
            Console.WriteLine(htmlElementDiv.HTMLElement);

            htmlElementDiv.addAtribute("href=\"www.softuni.bg\"");
            Console.WriteLine(htmlElementDiv.HTMLElement);
            HTMLDispatcher innerHTMLP = new HTMLDispatcher("p");
            innerHTMLP.InnerElement = "Some Text";
            Console.WriteLine(innerHTMLP.HTMLElement);

            htmlElementDiv.addAtribute("class=\"links\"");
            htmlElementDiv.InnerElement = innerHTMLP.HTMLElement;
            Console.WriteLine(htmlElementDiv * 2);

            Console.WriteLine(HTMLBuilder.CreateImage("www.softuni.bg", "OOP", "Class"));
    }
Beispiel #8
0
    static void Main(string[] args)
    {
        HTMLDispatcher htmlElementDiv = new HTMLDispatcher();

        Console.WriteLine(htmlElementDiv.HTMLElement);

        htmlElementDiv.addAtribute("href=\"www.softuni.bg\"");
        Console.WriteLine(htmlElementDiv.HTMLElement);
        HTMLDispatcher innerHTMLP = new HTMLDispatcher("p");

        innerHTMLP.InnerElement = "Some Text";
        Console.WriteLine(innerHTMLP.HTMLElement);

        htmlElementDiv.addAtribute("class=\"links\"");
        htmlElementDiv.InnerElement = innerHTMLP.HTMLElement;
        Console.WriteLine(htmlElementDiv * 2);

        Console.WriteLine(HTMLBuilder.CreateImage("www.softuni.bg", "OOP", "Class"));
    }
    static void Main(string[] args)
    {
        ElementBuilder div = new ElementBuilder("div");

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

        var test = HTMLDispatcher.CreateImage("smiley.gif", "Smiley face", "Smiling :)");

        Console.WriteLine(test);

        test = HTMLDispatcher.CreateURL("http://www.w3schools.com", "Click to visit site!", "Visit W3Schools.com!");
        Console.WriteLine(test);

        test = HTMLDispatcher.CreateInput("submit", "SubmitForm", "Submit");
        Console.WriteLine(test);
    }
Beispiel #10
0
    static void Main(string[] args)
    {
        ElementBuilder div = new ElementBuilder("div");

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

        ElementBuilder span = new ElementBuilder("span");

        span.AddAtribute("class", "first");
        Console.WriteLine(span);

        ElementBuilder li = new ElementBuilder("li");

        li.AddAtribute("type", "disk");
        li.AddContent("I am list");
        Console.WriteLine(li * 3);

        HTMLDispatcher.CreateImage("stickman.gif", "Stickman", "Biggest image");
        HTMLDispatcher.CreateURL("http://www.softuni.bg", "Software University", "Visit as!");
        HTMLDispatcher.CreateInput("submit", "sub-button", "submit");
    }