Ejemplo n.º 1
0
        void initView()
        {
            //content
            initResizableText();

            backImage                     = new UIImageView(new CGRect(112, 40, 800, borderHeight + 2 * 32));
            backImage.ContentMode         = UIViewContentMode.ScaleAspectFill;
            backImage.Layer.MasksToBounds = true;
            //backImage.Image = UIImage.FromFile ("MyImage.png");

            YConstants.DownloadImageAsync(source.ImageUrl).ContinueWith((task) => InvokeOnMainThread(() => {
                try { backImage.Image = task.Result; }
                catch { }
            }));


            Add(backImage);
            mainView = new UIView(new CGRect(112 + 32, 40 + 32, 800 - 2 * 32, borderHeight));           //32->separacion
            mainView.BackgroundColor = UIColor.FromRGBA(0, 0, 0, 75);
            Add(mainView);

            //BackgroundColor = UIColor.Red;

            //set frame
            slideHeight = mainView.Frame.Size.Height + 80 + 2 * 32;
            var frame = new CGRect(0, slidePos, YConstants.DeviceWidht, slideHeight);

            Frame = frame;


            //init controls
            mainView.Add(titleLabel);
            mainView.Add(contentLabel);
        }
Ejemplo n.º 2
0
        void initElement()
        {
            circleView = new UIView(new CGRect(0, 10, 10, 10))
            {
                BackgroundColor = BackColor
            };                                                                                        //posy=10
            circleView.Layer.CornerRadius  = 5;
            circleView.Layer.MasksToBounds = true;
            Add(circleView);

            textLabel = new UILabel(new CGRect(24, 0, textWidth, 18));
            textLabel.LineBreakMode = UILineBreakMode.WordWrap;
            textLabel.TextColor     = UIColor.Gray;
            textLabel.Font          = UIFont.FromName(fontName, 24);
            //textLabel.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. End m ipsum dolor sit amet, consectetur adipiscing elit. End ";
            textLabel.Text = content;
            textHeight     = YConstants.ResizeHeigthWithText(textLabel, maxHeight: 960f);
            Add(textLabel);


            cheight = textHeight + 12;
            var frame = new CGRect(30, position, 70, textHeight);

            Frame = frame;

            //BackgroundColor = UIColor.Red;
        }
Ejemplo n.º 3
0
        void initResizableText()
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;


            contentLabel = new UILabel(new CGRect(24, 0, 720, 100));
            contentLabel.LineBreakMode = UILineBreakMode.WordWrap;
            contentLabel.TextColor     = source.Color;         // UIColor.Purple;
            contentLabel.Font          = UIFont.FromName(fontName, 24);
            //contentLabel.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation END";
            //contentLabel.Text = source.Paragraph ;

            var myHtmlText = source.Paragraph;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlData = NSData.FromString(myHtmlText, NSStringEncoding.Unicode);

            contentLabel.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            contentLabel.Font           = UIFont.FromName(fontName, 24);

            contentHeight = YConstants.ResizeHeigthWithText(contentLabel, maxHeight: 960f);

            authorLabel = new UILabel(new CGRect(24, contentHeight + 12, 500, 24));
            authorLabel.LineBreakMode = UILineBreakMode.WordWrap;
            authorLabel.TextColor     = UIColor.Gray;
            authorLabel.Font          = UIFont.FromName(fontName, 16);
            //authorLabel.Text = "Author de la frase";
            authorLabel.Text = source.Author;
            authorHeight     = YConstants.ResizeHeigthWithText(authorLabel, maxHeight: 960f);

            borderHeight = authorHeight + contentHeight + 12;
        }
Ejemplo n.º 4
0
        void initView()
        {
            //content
            initResizableText();

            mainView = new UIView(new CGRect(112, 40, 800, 136 + contentHeight + 46));
            //mainView.Layer.BorderColor = new CGColor (48, 48, 48);
            mainView.Layer.BorderWidth = 1;
            //mainView.Layer.MasksToBounds = false;
            Add(mainView);

            //set frame
            slideHeight = mainView.Frame.Size.Height + 80;
            var frame = new CGRect(0, slidePos, YConstants.DeviceWidht, slideHeight);

            Frame = frame;

            //BackgroundColor = UIColor.Red;

            //init controls
            mainView.Add(contentLabel);

            //titleLabel = YConstants.GetNewTextLabel(26,26,256,22,22,UIColor.Black,1);
            //titleLabel.Text = "Aves Tipicas";
            //mainView.Add (titleLabel);

            subtitleLabel = YConstants.GetNewTextLabel(134, 46, 600, 48, 32, source.Color, 2);
            subtitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            //subtitleLabel.Text = "Diferentes tipos de Aves en el Peru";
            subtitleLabel.Text = source.Title;
            mainView.Add(subtitleLabel);

            authorLabel = YConstants.GetNewTextLabel(134, 104, 376, 14, 16, UIColor.Gray, 1);
            //authorLabel.Text = "Autor del Articulo";
            authorLabel.Text = source.Author;
            mainView.Add(authorLabel);

            //image
            image = new UIImageView(new CGRect(26, 26, 92, 92))
            {
                ContentMode = UIViewContentMode.ScaleToFill
            };
            //image.Image =  UIImage.FromFile ("MyImage.png");
            YConstants.DownloadImageAsync(source.ImageUrl).ContinueWith((task) => InvokeOnMainThread(() => {
                try { image.Image = task.Result; }
                catch { }
            }));
            image.Layer.MasksToBounds = true;
            image.ContentMode         = UIViewContentMode.ScaleAspectFill;
            mainView.Add(image);
        }
Ejemplo n.º 5
0
        void initResizableText()
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;

            titleLabel = new UILabel(new CGRect(0, 0, 800, 20));
            titleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            titleLabel.TextColor     = UIColor.Black;
            titleLabel.Font          = UIFont.FromName(YConstants.FontName, 32);
            //titleLabel.Text = "Aves Tipicas";
            //titleLabel.Text = source.Title ;
            var myHtmlTitle = source.Title;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlDataT = NSData.FromString(myHtmlTitle, NSStringEncoding.Unicode);

            titleLabel.AttributedText = new NSAttributedString(myHtmlDataT, attr, ref nsError);
            titleLabel.Font           = UIFont.FromName(YConstants.FontName, 32);

            titleHeight = YConstants.ResizeHeigthWithText(titleLabel, maxHeight: 960f);

            contentLabel = new UILabel(new CGRect(0, 0 + titleHeight + 30, 800, 200));
            contentLabel.LineBreakMode = UILineBreakMode.WordWrap;
            contentLabel.TextColor     = UIColor.Gray;
            contentLabel.Font          = UIFont.FromName(YConstants.FontName, 24);
            //contentLabel.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation END";
            //contentLabel.Text =  source.Paragraph ;

            //Next text from HTML

            //var myHtmlText = source.Paragraph; //"<b>Hello</b> <i>Everyone</i>";
            //contentLabel.AttributedText =  new  NSAttributedString(myHtmlText, attr, ref nsError);


            var myHtmlText = source.Paragraph;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlData = NSData.FromString(myHtmlText, NSStringEncoding.Unicode);

            contentLabel.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            contentLabel.Font           = UIFont.FromName(YConstants.FontName, 24);

            contentHeight = YConstants.ResizeHeigthWithText(contentLabel, maxHeight: 960f);

            borderHeight = titleHeight + contentHeight;
        }
Ejemplo n.º 6
0
        string titleText = "";        //LOL THIS IS  A TITLE " ;
        public void setName(string name, UIColor foreground)
        {
            //view for dinamic title
            titleView           = new UIView(new CGRect(120, 164, 200, 50));
            titleView.Transform = CGAffineTransformMakeSkew(-1 * skew, 44);
            Add(titleView);

            //text  title
            titleLabel = new UILabel(new CGRect(0, 0, 196, 22));
            titleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            titleLabel.Text          = name;
            titleLabel.TextColor     = foreground;
            titleLabel.Font          = UIFont.FromName("HelveticaNeue", 20);

            var text_height = YConstants.ResizeHeigthWithText(titleLabel, 100);

            titleLabel.Frame = new CGRect(0, (55 - text_height) / 2, 196, text_height);

            titleView.Add(titleLabel);
        }
Ejemplo n.º 7
0
        UIView get1image(nfloat pos, int p)
        {
            var imageView = new UIView(new CGRect(margin, pos, 800, height1 * 2));

            var img = new UIImageView(new CGRect(0, 0, 800, height1 * 2));

            img.ContentMode         = UIViewContentMode.ScaleAspectFill;
            img.Layer.MasksToBounds = true;
            //img.Image = UIImage.FromFile ("MyImage.png");
            img.BackgroundColor = UIColor.Gray;
            YConstants.DownloadImageAsync(source.Itemize[p].ImageUrl).ContinueWith((task) => InvokeOnMainThread(() => {
                try { img.Image = task.Result; }
                catch { }
            }));

            SetNeedsDisplay();
            imageView.Add(img);

            return(imageView);
        }
Ejemplo n.º 8
0
        UIView get3images(nfloat pos, int pi, int pf)
        {
            var images = new UIView(new CGRect(margin, pos, 800, height2));

            for (int i = pi; i <= pf; i++)
            {
                var img = new UIImageView(new CGRect(i * (width2 + separation), 0, width2, height2));
                img.ContentMode         = UIViewContentMode.ScaleAspectFill;
                img.Layer.MasksToBounds = true;
                //img.Image = UIImage.FromFile ("MyImage.png");
                img.BackgroundColor = UIColor.Gray;
                YConstants.DownloadImageAsync(source.Itemize[i].ImageUrl).ContinueWith((task) => InvokeOnMainThread(() => {
                    try { img.Image = task.Result; }
                    catch { }
                }));

                SetNeedsDisplay();
                images.Add(img);
            }
            return(images);
        }
Ejemplo n.º 9
0
        void initResizableText()
        {
            titleLabel = new UILabel(new CGRect(46, 20, 800, 32));
            titleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            titleLabel.TextColor     = UIColor.Purple;
            titleLabel.Font          = UIFont.FromName(fontName, 36);
            //titleLabel.Text = "Aves Tipicas";
            titleLabel.Text = source.Title;
            titleHeight     = YConstants.ResizeHeigthWithText(titleLabel, maxHeight: 960f);

            contentHeight = 82;
            for (int i = 0; i < source.Itemize.Count; i++)
            {
                ItemizeElement el = new ItemizeElement(contentHeight);
                el.BackColor   = source.Color;
                el.Content     = source.Itemize [i].Text;
                contentHeight += el.GetHeight();
                elements.Add(el);
            }

            borderHeight = contentHeight + separation;
        }
Ejemplo n.º 10
0
        void initResizableText()
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;


            contentLabel = new UILabel(new CGRect(26, 146, 748, 200));
            contentLabel.LineBreakMode = UILineBreakMode.WordWrap;
            contentLabel.TextColor     = UIColor.Gray;
            contentLabel.Font          = UIFont.FromName(YConstants.FontName, 24);
            //mainView.Add (contentLabel);

            //contentLabel.Text = source.Paragraph;   //"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation END";
            var myHtmlTitle = source.Paragraph;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlDataT = NSData.FromString(myHtmlTitle, NSStringEncoding.Unicode);

            contentLabel.AttributedText = new NSAttributedString(myHtmlDataT, attr, ref nsError);
            contentLabel.Font           = UIFont.FromName(YConstants.FontName, 24);

            contentHeight = YConstants.ResizeHeigthWithText(contentLabel, maxHeight: 960f);
        }
Ejemplo n.º 11
0
        void addTitle(string t, string st)
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;

            nfloat xpos = 474, ypos = 380, delta = 74, pw = 486;

            //description
            pageDescription = new UILabel(new CGRect(xpos, ypos, pw, 70))
            {
                //Text = "SUBTITULOOOOO" ,//st ,
                Font          = UIFont.FromName("HelveticaNeue", 24),
                TextColor     = UIColor.White,
                LineBreakMode = UILineBreakMode.WordWrap,
                TextAlignment = UITextAlignment.Right
            };
            //Adding text HTML
            var myHtmlText = st;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlData = NSData.FromString(myHtmlText, NSStringEncoding.Unicode);

            pageDescription.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            pageDescription.Font           = UIFont.FromName("HelveticaNeue", 24);
            pageDescription.TextColor      = UIColor.White;
            pageDescription.LineBreakMode  = UILineBreakMode.WordWrap;
            pageDescription.TextAlignment  = UITextAlignment.Right;

            var d_h = YConstants.ResizeHeigthWithText(pageDescription, 300);

            ypos = position - d_h - delta;
            pageDescription.Frame = new CGRect(xpos, ypos, pw, d_h);
            contentView.Add(pageDescription);

            //line
            ypos -= 20;
            var line = new UIView(new CGRect(xpos, ypos, pw, 1))
            {
                BackgroundColor = UIColor.White
            };

            contentView.Add(line);
            ypos -= 20;

            //title
            pageTitle = new UILabel(new CGRect(xpos, ypos, pw, 70))
            {
                Text          = t,
                Font          = UIFont.FromName("HelveticaNeue", 42),
                TextColor     = UIColor.White,
                LineBreakMode = UILineBreakMode.WordWrap,
                TextAlignment = UITextAlignment.Right
            };
            var t_h = YConstants.ResizeHeigthWithText(pageTitle, 200);

            ypos -= t_h;

            pageTitle.Frame = new CGRect(xpos, ypos, pw, t_h);
            contentView.Add(pageTitle);
        }