Ejemplo n.º 1
0
 public static string CreateURL(string url, string title, string text)
 {
     ElementBuilder result = new ElementBuilder("a");
     result.AddAttribute("href", url);
     result.AddAttribute("title", title);
     result.AddContent(text);
     return result.ToString();
 }
Ejemplo n.º 2
0
 public static string CreateImage(string source, string alt, string title)
 {
     ElementBuilder result = new ElementBuilder("img");
     result.AddAttribute("src", source);
     result.AddAttribute("alt", alt);
     result.AddAttribute("title", title);
     return result.ToString();
 }
Ejemplo n.º 3
0
 public static string CreateInput(string type, string name, string value)
 {
     ElementBuilder result = new ElementBuilder("input");
     result.AddAttribute("type", type);
     result.AddAttribute("name", type);
     result.AddAttribute("value", value);
     return result.ToString();
 }
Ejemplo n.º 4
0
        public static string CreateInput(string type, string name, string value)
        {
            ElementBuilder result = new ElementBuilder("input");

            result.AddAttribute("type", type);
            result.AddAttribute("name", type);
            result.AddAttribute("value", value);
            return(result.ToString());
        }
Ejemplo n.º 5
0
        public static string CreateURL(string url, string title, string text)
        {
            ElementBuilder result = new ElementBuilder("a");

            result.AddAttribute("href", url);
            result.AddAttribute("title", title);
            result.AddContent(text);
            return(result.ToString());
        }
Ejemplo n.º 6
0
        public static string CreateImage(string source, string alt, string title)
        {
            ElementBuilder result = new ElementBuilder("img");

            result.AddAttribute("src", source);
            result.AddAttribute("alt", alt);
            result.AddAttribute("title", title);
            return(result.ToString());
        }
         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;
         }
         public static ElementBuilder 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;

         }
         public static ElementBuilder CreateImage(string source,string alt,string title)
         {

             ElementBuilder image = new ElementBuilder("img");

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

             return image;

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

            Console.WriteLine(Environment.NewLine);

            Console.WriteLine(HTMLDispatcher.CreateURL("www.abv.bg","Abv.bg","Go to abv.bg.."));
            Console.WriteLine(HTMLDispatcher.CreateInput("submit", "fname", "Submit"));
            Console.WriteLine(HTMLDispatcher.CreateImage("www.abv.bg/logo.png", "Abv.bg", "Abv Logo"));
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            ElementBuilder x = new ElementBuilder("div");

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

            Console.WriteLine(Environment.NewLine);

            Console.WriteLine(HTMLDispatcher.CreateURL("www.abv.bg", "Abv.bg", "Go to abv.bg.."));
            Console.WriteLine(HTMLDispatcher.CreateInput("submit", "fname", "Submit"));
            Console.WriteLine(HTMLDispatcher.CreateImage("www.abv.bg/logo.png", "Abv.bg", "Abv Logo"));
        }
Ejemplo n.º 12
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();

            string img = HTMLDispatcher.CreateImage("img.png", "image", "Gandalf");
            string input = HTMLDispatcher.CreateInput("text", "userName", "For Frodo!");
            string url = HTMLDispatcher.CreateURL("https://www.youtube.com/watch?v=fjC7dctw7LU", "Harder, Better, Faster, Stronger", "The cake is a lie...");
            Console.WriteLine(img);
            Console.WriteLine(input);
            Console.WriteLine(url);
        }
        public static void Main()
        {
            ElementBuilder htmlElement = new ElementBuilder("a");

            htmlElement.AddAttribute("href", "www.softuni.bg");
            htmlElement.AddAttribute("class", "links");

            Console.WriteLine("Element with two attributes:");
            Console.WriteLine(htmlElement.ToString());

            htmlElement.AddContent("Software University");

            Console.WriteLine("\nAdded content:");
            Console.WriteLine(htmlElement.ToString());

            ElementBuilder htmlElement2 = htmlElement * 4;

            Console.WriteLine("\nElement multiplied 4 times, and accessed through .Element:");
            Console.WriteLine(htmlElement2.Element.ToString());

            Console.ReadKey();
        }
         public static ElementBuilder operator *(ElementBuilder currentElement,int count)
         {

             if (count <= 0)
             {
                 throw new ArgumentOutOfRangeException("count","Count should be greater than zero.");

             }

             ElementBuilder newElement = new ElementBuilder(currentElement.Tag);

             newElement.Attributes = currentElement.Attributes;
             newElement.Content = currentElement.Content;
             newElement.Repetitions *= count;
             newElement.IsSelfClosing = currentElement.IsSelfClosing;

             return newElement;


         }