Exemplo n.º 1
0
 public static string 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.ToString();
 }
Exemplo n.º 2
0
 public static string CreateImage(string imgSource, string alt, string title)
 {
     ElementBuilder image = new ElementBuilder("img");
     image.AddAttribute("src", imgSource);
     image.AddAttribute("alt", alt);
     image.AddAttribute("title", title);
     return image.ToString();
 }
Exemplo n.º 3
0
 public static string CreateInput(string type, string name, string value)
 {
     ElementBuilder input = new ElementBuilder("input");
     input.AddAttribute("type", type);
     input.AddAttribute("name", name);
     input.AddAttribute("value", value);
     return input.ToString();
 }
Exemplo n.º 4
0
Arquivo: Program.cs Projeto: Gab42/OOP
        static void Main(string[] args)
        {
            try
            {
                var div = new ElementBuilder("div");
                div.AddAttribute("id", "page");
                div.AddAttribute("class", "big");
                div.AddContent("<p>Hello</p>");
                Console.WriteLine(div * 3);

                Console.WriteLine(HTMLDispatcher.CreateImage("http://vicove.com/jokepics/thumb_sredna_51453.jpg", "bus", "bus.rar"));
                Console.WriteLine(HTMLDispatcher.CreateUrl("http://vicove.com/", "Click me for more fun", "vicove.com"));
                Console.WriteLine(HTMLDispatcher.CreateInput("textform", "email", "*****@*****.**"));
            }
            catch (ArgumentOutOfRangeException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }