示例#1
0
        public override string ToFullCode()
        {
            const string Template1 = @"[{Name}]";
            const string Template2 = @"[{Name}({Ctor})]";
            const string Template3 = @"[{Name}({Propertys})]";
            const string Template4 = @"[{Name}({Ctor},{Propertys})]";
            string       code;

            if (string.IsNullOrEmpty(_attribute.Ctor))
            {
                if (_attribute.Propertys.Count == 0)
                {
                    code = Template1.Replace("{Name}", _attribute.Name);
                }
                else
                {
                    code = Template3.Replace("{Name}", _attribute.Name).Replace("{Propertys}", _attribute.Propertys.Join(","));
                }
            }
            else
            {
                if (_attribute.Propertys.Count == 0)
                {
                    code = Template2.Replace("{Name}", _attribute.Name).Replace("{Ctor}", _attribute.Ctor);
                }
                else
                {
                    code = Template4.Replace("{Name}", _attribute.Name)
                           .Replace("{Ctor}", _attribute.Ctor)
                           .Replace("{Propertys}", _attribute.Propertys.Join(","));
                }
            }

            return(code);
        }
示例#2
0
        public void Transforming_Template3WithInclude_ResultsInExpectedOutput()
        {
            // Arrange.
            var transformer = new TextTemplateTransformer();
            var expected    = new Template3().TransformText();

            // Act.
            string output = transformer.TransformFile(@"Templates\Template3.tt");

            // Assert.
            Assert.AreEqual(expected, output);
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //*
            IProblem tester = new Template1();
            var      test   = 2;

            switch (test)
            {
            case 1:
                tester = new Template1();
                break;

            case 2:
                tester = new Template2();
                break;

            case 3:
                tester = new Template3();
                break;

            case 4:
                tester = new Template4();
                break;

            case 5:
                tester = new Template5();
                break;

            case 6:
                tester = new CountBits_();
                break;

            case 7:
                tester = new AppendAndDelete();
                break;
            }

            tester.RunTest();

            /*/
             * var tester = new  CamelChase();
             * tester.RunTest();
             * //*/
        }
示例#4
0
        public RelativeLayout getViewSlide()
        {
            if (_type == 1)
            {
                Template1 plantilla = new Template1(context);
                plantilla.Title      = _title;
                plantilla.Author     = _author;
                plantilla.Contenido  = _paragraph;
                plantilla.ImageUrl   = _imageurl;
                plantilla.ColorTexto = _colorS;
                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  111111");
                return(plantilla);
            }
            if (_type == 2)
            {
                Template2 plantilla = new Template2(context);
                plantilla.Title      = _title;
                plantilla.Contenido  = _paragraph;
                plantilla.ColorTexto = _colorS;

                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  222222");
                return(plantilla);
            }
            if (_type == 3)
            {
                Template3 plantilla = new Template3(context);
                plantilla.Title = _title;
                string [] lista = new string[_itemize.Count];
                for (int i = 0; i < _itemize.Count; i++)
                {
                    lista[i] = _itemize[i].Text;
                }
                //string[] lista = {"sdfsdf sdfs fsdf sf sdfs"," dfsdfsdf sdfsd fsd ds"," fsdf sfsdf sdfsd"," fdsfsdf sdfsdf sdfsf"};
                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  333333");
                plantilla.ListItems = lista;
                return(plantilla);
            }
            if (_type == 4)
            {
                Template4 plantilla = new Template4(context);
                return(plantilla);
                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  4444444444");
            }
            if (_type == 5)
            {
                PhraseView plantilla = new PhraseView(context);
                plantilla.Author        = _author;
                plantilla.Phrase        = _paragraph;
                plantilla.ImagenComilla = "icons/comillasa.png";
                plantilla.ImagenBarra   = "icons/lineafraseamarilla.png";
                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  5");
                return(plantilla);
            }
            if (_type == 6)
            {
                CustomerImageView plantilla = new CustomerImageView(context);
                plantilla.Title       = _title;
                plantilla.Description = _paragraph;
                plantilla.Imagen      = _imageurl;           //BitmapFactory.DecodeByteArray (_imagebytes, 0, _imagebytes.Length);
                plantilla.ColorTexto  = _colorS;
                return(plantilla);
            }

            if (_type == 7)
            {
                CustomerVideoView plantilla = new CustomerVideoView(context);
                plantilla.Title      = _title;
                plantilla.Imagen     = _imageurl;
                plantilla.ImagenPlay = "images/playa.png";
                return(plantilla);
            }
            return(null);
        }
示例#5
0
        public RelativeLayout getViewSlide()
        {
            if (_type == 1)
            {
                Template1 plantilla = new Template1(context);

                plantilla.Author = _author;

                if (_title == null)
                {
                    _title = "";
                }

                if (!_title.Equals(""))
                {
                    List <string> elements = parseContent(_title);
                    //Console.WriteLine (String.Format("Holaaaa {0}",elements.Count));


                    if (elements.Count != 0 && elements[0] == "@")
                    {                    //Console.WriteLine (elements.ToString());
                        if (elements[2].Equals("#NONE"))
                        {
                            plantilla.ColorTexto = elements[1];
                        }
                        else
                        {
                            plantilla.ColorTexto = _colorS;
                        }
                    }
                }
                plantilla.Title = _title;

                plantilla.ImageUrl  = _imageurl;               //<----------HUILLCA
                plantilla.Contenido = eraseLastBR(_paragraph);;

                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  111111");
                return(plantilla);
            }
            if (_type == 2)
            {
                Template2 plantilla = new Template2(context);

                if (_title == null)
                {
                    _title = " ";
                }
                List <string> elements = parseContent(_title);
                //Console.WriteLine (String.Format("Holaaaa {0}",elements.Count));


                if (elements.Count != 0 && elements [0] == "@")                  //Console.WriteLine (elements.ToString());


                {
                    if (!elements[2].Equals("#NONE"))
                    {
                        plantilla.ColorDescription        = elements[2];
                        plantilla.ColorTitle              = elements[2];
                        plantilla.ColorBackgroundTemplate = elements[1];
                    }
                    else
                    {
                        plantilla.ColorTitle = elements[1];
                    }
                }
                else
                {
                    plantilla.ColorTexto = _colorS;
                }


                plantilla.Title     = _title;
                plantilla.Contenido = eraseLastBR(_paragraph);

                /*Datos básicos*/
                if (_title.Equals("Datos básicos "))
                {
                    string pathImg = "mapas/" + replaceForImages(title_page) + ".png";
                    plantilla.Image = getBitmapFromAsset(pathImg);
                    Console.WriteLine(pathImg);
                }

                return(plantilla);
            }
            if (_type == 3)
            {
                Template3 plantilla = new Template3(context);
                plantilla.Title = _title;
                string [] lista = new string[_itemize.Count];
                for (int i = 0; i < _itemize.Count; i++)
                {
                    lista[i] = _itemize[i].Text;
                }
                plantilla.ListItems = lista;
                return(plantilla);
            }
            if (_type == 4)
            {
                Template4 plantilla = new Template4(context);
                return(plantilla);
                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  4444444444");
            }
            if (_type == 5)
            {
                PhraseView plantilla = new PhraseView(context);
                //plantilla.Author = _author;
                plantilla.Phrase = _paragraph;
                //plantilla.ImagenComilla = "icons/comillasa.png";
                //plantilla.ImagenBarra = "icons/lineafraseamarilla.png";
                //Console.WriteLine ("CREA PLANTILLAAAAAAAAA  5");
                return(plantilla);
            }
            if (_type == 6)
            {
                CustomerImageView plantilla = new CustomerImageView(context);
                plantilla.Title       = _title;
                plantilla.Description = _paragraph;
                plantilla.Imagen      = _imageurl;           //BitmapFactory.DecodeByteArray (_imagebytes, 0, _imagebytes.Length);
                plantilla.ColorTexto  = _colorS;
                return(plantilla);
            }

            if (_type == 7)
            {
                CustomerVideoView plantilla = new CustomerVideoView(context);
                plantilla.Title      = _title;
                plantilla.Imagen     = _imageurl;
                plantilla.ImagenPlay = "images/playa.png";
                return(plantilla);
            }
            return(null);
        }