예제 #1
0
 public static string CreateURL(string url, string title, string text)
 {
     ElementBuilder el = new ElementBuilder("a");
     el.AddAttribute("href", url);
     el.AddAttribute("title", title);
     el.AddContent(text);
     return el.ToString();
 }
예제 #2
0
 public static string CreateImage(string imageSource, string alt, string title)
 {
     ElementBuilder el = new ElementBuilder("img");
     el.AddAttribute("src", imageSource);
     el.AddAttribute("alt", alt);
     el.AddAttribute("title", title);
     return el.ToString();
 }
예제 #3
0
 public static string CreateInput(string inputType, string name, string value)
 {
     ElementBuilder el = new ElementBuilder("input");
     el.AddAttribute("type", inputType);
     el.AddAttribute("name", name);
     el.AddAttribute("value", value);
     return el.ToString();
 }
예제 #4
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);

            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);
        }