示例#1
0
            public ResolutionTestNode(State stateref, string name)
                : base(stateref, name)
            {
                Body        = new Body(this, "Body");
                Body.Bounds = new Vector2(70, 70);

                _physics = new Physics(this, "_physics");
                _physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);
                _physics.Mass        = 10f;
                _physics.Restitution = 1f;
                _physics.Drag        = .95f;

                Shape = new AABB(this, "AABB");
                Shape.LinkDependency(AABB.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, _physics);
                Collision.Initialize();

                _imageRender = new ImageRender(this, "Image", Assets.Pixel);
                _imageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
                _imageRender.Scale = new Vector2(70, 70);
                _imageRender.Layer = .5f;

                _textBody = new Body(this, "_textBody");

                _textRender = new TextRender(this, "_textRender");
                _textRender.LinkDependency(TextRender.DEPENDENCY_BODY, _textBody);
                _textRender.Color = Color.White;
                _textRender.Font  = Assets.Font;
                _textRender.Text  = Name;
                _textRender.Layer = 1f;
            }
示例#2
0
 public Image(ControlHandler parent, string name, Texture2D texture)
     : base(parent, name)
 {
     ImageRender = new ImageRender(this, "ImageRender", texture);
     ImageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
     Selectable = false;
 }
示例#3
0
        public Bullet(Node parent, string name)
            : base(parent, name)
        {
            Render = new ImageRender(this, "Render");
            Render.SetTexture(GetRoot <State>().GetService <AssetCollector>().GetAsset <Texture2D>("bullet"));
            Render.Layer = .1f;
            Render.Scale = new Vector2(.1f);
            Render.Color = Color.White;
            Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

            //Make our collision rectangles the size of the rendered sprite.
            Body.Bounds = Render.Bounds;
            Body.Origin = new Vector2(Render.Texture.Width / 2f, Render.Texture.Height / 2f);

            Shape        = new Circle(this, "Shape", Body.Width / 2);
            Shape.Offset = new Vector2(Body.Width / 2, Body.Height / 2);
            Shape.LinkDependency(Circle.DEPENDENCY_BODY, Body);

            Collision.Group.AddMask(1);
            Collision.Pair.AddMask(2);
            Collision.Immovable     = true;
            Collision.CollideEvent += collision => Recycle();
            Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
            Shape.LinkDependency(Circle.DEPENDENCY_COLLISION, Collision);

            DeathTimer = new Timer(this, "DeathTimer");
            DeathTimer.Milliseconds = 2000;
            DeathTimer.LastEvent   += Recycle;
            DeathTimer.LastEvent   += DeathTimer.Stop;
        }
示例#4
0
        public Cursor(EntityState es, Town t, XmlParser xp)
            : base(es, "Cursor")
        {
            _town = t;

            //Current data path is GameState->Town->Cursor
            var path = es.Name + "->" + _town.Name + "->" + Name;

            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            ImageRender = new ImageRender(this, "ImageRender");
            AddComponent(ImageRender);

            _aimleftkey = new DoubleInput(this, "AimLeftKey", Keys.A, Buttons.DPadLeft, PlayerIndex.One);
            AddComponent(_aimleftkey);

            _aimrightkey = new DoubleInput(this, "AimRightKeys", Keys.D, Buttons.DPadRight, PlayerIndex.One);
            AddComponent(_aimrightkey);

            _quickaimkey = new DoubleInput(this, "QuickAimKey", Keys.LeftShift, Buttons.RightShoulder, PlayerIndex.One);
            AddComponent(_quickaimkey);

            ParseXml(xp, path);

            ImageRender.Origin = new Vector2(ImageRender.Texture.Width / 2f, ImageRender.Texture.Height / 2f);
            Body.Position = _town.Body.Position +
                            (_town.TileRender.Origin - Vector2.UnitY * 40 - ImageRender.Origin) *
                            ImageRender.Scale;
        }
示例#5
0
        private void InitImages()
        {
            if (APNGFile.IsAnimated)
            {
                Bitmap current  = new Bitmap((int)APNGFile.Width, (int)APNGFile.Height);
                Bitmap previous = null;

                ImageRender.RenderNextFrame(current, Point.Empty, APNGFile.ToBitmap(0), Frame.BlendOperation.SOURCE);
                Images.Add(new Bitmap(current));

                for (int i = 1; i < APNGFile.FrameCount; i++)
                {
                    APNGLib.Frame oldFrame = APNGFile.GetFrame(i - 1);
                    Bitmap        prev     = previous == null ? null : new Bitmap(previous);
                    if (oldFrame.DisposeOp != APNGLib.Frame.DisposeOperation.PREVIOUS)
                    {
                        previous = new Bitmap(current);
                    }
                    ImageRender.DisposeBuffer(current, new Rectangle((int)oldFrame.XOffset, (int)oldFrame.YOffset, (int)oldFrame.Width, (int)oldFrame.Height), oldFrame.DisposeOp, prev);
                    APNGLib.Frame currFrame = APNGFile.GetFrame(i);
                    ImageRender.RenderNextFrame(current, new Point((int)currFrame.XOffset, (int)currFrame.YOffset), APNGFile.ToBitmap(i), currFrame.BlendOp);
                    Images.Add(new Bitmap(current));
                }
            }
            else
            {
                Images.Add(APNGFile.ToBitmap());
            }
        }
示例#6
0
        public async void picture()
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsPickPhotoSupported || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("Seleção de imagem", "Seu aparelho não suporta esta ação", "Ok");
            }
            else
            {
                var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    Directory          = "my_images",
                    CompressionQuality = 40,
                    PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Custom,
                    CustomPhotoSize    = 40
                });

                if (file != null)
                {
                    Stream fileStream = file.GetStream();

                    string newName = ImageRender.newName(fileStream);

                    imagePost.Text = newName;

                    string url = saveImage("post", newName, fileStream);

                    imageCharged.Source = ImageSource.FromStream(file.GetStream);
                }
            }
        }
示例#7
0
        public BlogAll()
        {
            InitializeComponent();

            makeBlog(false, "", true);

            img_main.Source = ImageRender.display("post", "img6.png");
        }
 public CameraNode(State stateref, string name)
     : base(stateref, name)
 {
     Body  = new Body(this, "Body", new Vector2(EntityGame.Viewport.Width / 2f, EntityGame.Viewport.Height / 2f));
     Image = new ImageRender(this, "Image", Assets.Pixel);
     Image.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
     Image.Scale = new Vector2(50, 100);
     Image.Color = Color.Red;
 }
示例#9
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     if (path != "")
     {
         Debug.Log(path);
         Image = GameObject.Find("Image");
         GetPhoto(Image, path);
     }
 }
示例#10
0
        public Image(EntityState es, string name, Texture2D texture, Vector2 position)
            : base(es, name)
        {
            Body = new Body(this, "Body", position);
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            ImageBaseRender = new ImageRender(this, "ImageRender", texture);
            AddComponent(ImageBaseRender);
        }
示例#11
0
        public Image(EntityState es, string name)
            : base(es, name)
        {
            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            ImageBaseRender = new ImageRender(this, "ImageRender");
            AddComponent(ImageBaseRender);
        }
示例#12
0
        /// <summary>
        ///
        /// </summary>
        public List <data_apng> fun_取得解析後的APNG()
        {
            List <data_apng> ar_apng = new List <data_apng>();

            if (APNGFile.IsAnimated)
            {
                Bitmap current  = new Bitmap((int)APNGFile.Width, (int)APNGFile.Height);
                Bitmap previous = null;

                ImageRender.RenderNextFrame(current, System.Drawing.Point.Empty, APNGFile.ToBitmap(0), Frame.BlendOperation.SOURCE);
                fun_add(new Bitmap(current), ar_apng, APNGFile.GetFrame(0).Milliseconds);

                for (int i = 1; i < APNGFile.FrameCount; i++)
                {
                    APNGLib.Frame oldFrame = APNGFile.GetFrame(i - 1);
                    Bitmap        prev     = previous == null ? null : new Bitmap(previous);
                    if (oldFrame.DisposeOp != APNGLib.Frame.DisposeOperation.PREVIOUS)
                    {
                        previous = (current);
                    }
                    ImageRender.DisposeBuffer(current, new Rectangle((int)oldFrame.XOffset, (int)oldFrame.YOffset, (int)oldFrame.Width, (int)oldFrame.Height), oldFrame.DisposeOp, prev);
                    APNGLib.Frame currFrame = APNGFile.GetFrame(i);
                    ImageRender.RenderNextFrame(current, new System.Drawing.Point((int)currFrame.XOffset, (int)currFrame.YOffset), APNGFile.ToBitmap(i), currFrame.BlendOp);
                    fun_add(new Bitmap(current), ar_apng, APNGFile.GetFrame(i).Milliseconds);


                    if (prev != null)
                    {
                        prev.Dispose();
                        prev = null;
                    }
                }

                if (current != null)
                {
                    current.Dispose();
                    current = null;
                }
                if (previous != null)
                {
                    previous.Dispose();
                    previous = null;
                }
            }
            else    //如果不是動畫

            {
                fun_add(APNGFile.ToBitmap(), ar_apng, 60);
            }

            return(ar_apng);
        }
示例#13
0
        protected override async void OnAppearing()
        {
            bool validate = await CheckAuth.validate();

            if (!validate)
            {
                App.Current.MainPage = new NavigationPage(new Login());
            }

            base.OnAppearing();

            img_category.Source = ImageRender.display("post", "foto5.jpg");
        }
示例#14
0
            public AsteroidGhost(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");

                Render = new ImageRender(this, "Render");
                Render.SetTexture(GetRoot <State>().GetService <AssetCollector>().GetAsset <Texture2D>("circle"));
                Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.Pair.AddMask(0);
                Collision.Pair.AddMask(1);
                Collision.Pair.AddMask(2);
                Collision.Group.AddMask(3);
            }
示例#15
0
        public PlayerShip(Node parent, string name)
            : base(parent, name)
        {
            Body.X = EntityGame.Viewport.Width / 2f;
            Body.Y = EntityGame.Viewport.Height / 2f;

            Physics.Drag        = 0.97f;
            Physics.AngularDrag = 0.9f;

            Render = new ImageRender(this, "Render");
            Render.SetTexture(GetRoot <State>().GetService <AssetCollector>().GetAsset <Texture2D>("ship"));
            Render.Layer = .01f;
            Render.Scale = new Vector2(.128f);
            Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

            Body.Bounds = Render.Bounds;
            Body.Origin = new Vector2(Render.Texture.Width / 2f, Render.Texture.Height / 2f);


            Gun = new SimpleGun(this, "SimpleGun");
            Gun.LinkDependency(SimpleGun.DEPENDENCY_BODY, Body);
            Gun.LinkDependency(SimpleGun.DEPENDENCY_PHYSICS, Physics);
            Shape        = new Circle(this, "Circle", Body.Width * .8f);
            Shape.Offset = new Vector2(Body.Width / 2, Body.Height / 2);
            Shape.Debug  = true;
            Shape.LinkDependency(Circle.DEPENDENCY_BODY, Body);

            Collision.Group.AddMask(0);
            Collision.Pair.AddMask(2);
            Collision.CollideEvent += OnCollide;
            Collision.Immovable     = true;
            Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
            Shape.LinkDependency(Circle.DEPENDENCY_COLLISION, Collision);


            //Control
            UpButton      = new DoubleInput(this, "UpButton", Keys.W, Buttons.DPadUp, PlayerIndex.One);
            DownButton    = new DoubleInput(this, "DownButton", Keys.S, Buttons.DPadDown, PlayerIndex.One);
            LeftButton    = new DoubleInput(this, "LeftButton", Keys.A, Buttons.DPadLeft, PlayerIndex.One);
            RightButton   = new DoubleInput(this, "RightButton", Keys.D, Buttons.DPadRight, PlayerIndex.One);
            FireButton    = new DoubleInput(this, "FireButton", Keys.Space, Buttons.A, PlayerIndex.One);
            ThrustTrigger = new GamePadTrigger(this, "ThrustTrigger", Triggers.Right, PlayerIndex.One);
            //GravityTrigger = new GamePadTrigger(this, "GravityTrigger", Triggers.Left, PlayerIndex.One);

            LookAnalog = new GamePadAnalog(this, "LookAnalog", Sticks.Left, PlayerIndex.One);
        }
示例#16
0
            public CircleTester(Node parent, string name, float radius)
                : base(parent, name)
            {
                Circle        = new Circle(this, "Circle", radius);
                Circle.Offset = new Vector2(radius);
                Circle.LinkDependency(Circle.DEPENDENCY_BODY, Body);
                Circle.LinkDependency(Circle.DEPENDENCY_COLLISION, Collision);

                Body.Bounds = new Vector2(Circle.Diameter);

                Render       = new ImageRender(this, "Render", Assets.Circle);
                Render.Scale = new Vector2(Circle.Diameter / Assets.Circle.Width);
                Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

                Body.Origin = new Vector2(Render.Texture.Width / 2f, Render.Texture.Height / 2f);
                Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Circle);
            }
示例#17
0
        public Asteroid(Node parent, string name)
            : base(parent, name)
        {
            Body.X     = RandomHelper.GetFloat() * EntityGame.Viewport.Right;
            Body.Y     = RandomHelper.GetFloat() * EntityGame.Viewport.Bottom;
            Body.Angle = MathHelper.TwoPi * RandomHelper.GetFloat();

            Physics.Thrust(RandomHelper.GetFloat(30, 60));
            Physics.Restitution = 1.5f;

            Render = new ImageRender(this, "Render");
            Render.SetTexture(GetRoot <State>().GetService <AssetCollector>().GetAsset <Texture2D>("circle"));
            Render.Scale = new Vector2(RandomHelper.GetFloat(.25f, .5f));
            Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

            Body.Width  = Render.DrawRect.Width;
            Body.Height = Render.DrawRect.Height;
            Body.Origin = new Vector2(Render.Texture.Width / 2f, Render.Texture.Height / 2f);

            Physics.Mass = Render.Scale.X;

            Health            = new Health(this, "Health", 3);
            Health.DiedEvent += entity => Destroy(this);

            Shape        = new Circle(this, "Circle", Body.Width / 2);
            Shape.Offset = new Vector2(Body.Width / 2, Body.Height / 2);
            Shape.Debug  = true;
            Shape.LinkDependency(Circle.DEPENDENCY_BODY, Body);

            Collision.Pair.AddMask(0);
            Collision.Pair.AddMask(1);
            Collision.Group.AddMask(2);
            Collision.Pair.AddMask(2);
            Collision.ResolutionGroup.AddMask(2);
            Collision.CollideEvent += OnCollide;
            Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
            Shape.LinkDependency(Circle.DEPENDENCY_COLLISION, Collision);

            _ghoster = new AsteroidGhoster(this, "Ghoster");
            _ghoster.LinkDependency(AsteroidGhoster.DEPENDENCY_BODY, Body);
            _ghoster.LinkDependency(AsteroidGhoster.DEPENDENCY_RENDER, Render);
            _ghoster.LinkDependency(AsteroidGhoster.DEPENDENCY_COLLISION, Collision);
            _ghoster.Initialize();
            _ghoster.SetOnCollide(OnCollide);
        }
示例#18
0
            /// <summary>
            /// /Creates a new AABBEntity
            /// </summary>
            /// <param name="stateref"></param>
            /// <param name="name"></param>
            public CollisionTestNode(State stateref, string name)
                : base(stateref, name)
            {
                Body = new Body(this, "Body");

                Physics = new Physics(this, "Physics");
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);

                ImageRender = new ImageRender(this, "Image", Assets.Pixel);
                ImageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

                TextBody = new Body(this, "TextBody");

                TextRender = new TextRender(this, "Render");
                TextRender.LinkDependency(TextRender.DEPENDENCY_BODY, TextBody);
            }
示例#19
0
        protected override async void OnAppearing()
        {
            string endpoint = "portalib-dev-book";

            IDictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "idUser", Convert.ToString(userId) },
                { "idBook", Convert.ToString(bookId) }
            };

            IDictionary <string, string> call = new Dictionary <string, string>
            {
                { "act", "data" },
                { "mod", "book" }
            };

            dynamic res = await decora.Service.Run(endpoint, call, "GET", parameters);

            imagePost.Text      = (string)res["image"];
            bookTitle.Text      = (string)res["title"];
            imageCharged.Source = ImageRender.display("post", (string)res["image"]);
        }
示例#20
0
        public Bomb(EntityState es, string name, XmlParser xp)
            : base(es, name)
        {
            string path = es.Name + "->" + "Bomb";

            Name = Name + ID;

            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            Collision = new Collision(this, "Collision");
            Collision.CollideEvent += CollisionHandler;
            AddComponent(Collision);

            ImageRender = new ImageRender(this, "ImageRender");
            AddComponent(ImageRender);

            _explodeanim = new Animation(this, "ExplodeAnim");
            _explodeanim.LastFrameEvent += Destroy;
            AddComponent(_explodeanim);

            _explodesound = new Sound(this, "ExplodeSound");
            AddComponent(_explodesound);

            _explosionemitter = new ExplosionEmitter(this);
            AddComponent(_explosionemitter);

            _smokeemitter = new SmokeEmitter(this);
            AddComponent(_smokeemitter);

            ParseXml(xp, path);

            //TODO: Hook up Collision.CollideEvent to a handler
            _explodeanim.Origin = new Vector2(_explodeanim.TileSize.X / 2.0f, _explodeanim.TileSize.Y / 2.0f);
            ImageRender.Origin = new Vector2(ImageRender.Texture.Width / 2f, ImageRender.Texture.Height / 2f);
        }
示例#21
0
        public async void selPicture()
        {
            await CrossMedia.Current.Initialize();

            var imgData = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions()
            {
                CompressionQuality = 40,
                PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Custom,
                CustomPhotoSize    = 40
            });

            if (imgData != null)
            {
                Stream fileStream = imgData.GetStream();

                string newName = ImageRender.newName(fileStream);

                imagePost.Text = newName;

                string url = saveImage("post", newName, fileStream);

                imageCharged.Source = ImageSource.FromStream(imgData.GetStream);
            }
        }
示例#22
0
        public async void makePost(int idPost)
        {
            bt_veja.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(async() =>
                {
                    await scrollView.ScrollToAsync(0, Application.Current.MainPage.Height, true);
                })
            });

            string endpoint = "portalib-dev-post";

            IDictionary <string, int> parameters = new Dictionary <string, int>()
            {
                { "idPost", idPost },
                { "idUser", Convert.ToInt32(Settings.config_user) }
            };

            IDictionary <string, string> call = new Dictionary <string, string>
            {
                { "act", "data" },
                { "mod", "post" }
            };

            dynamic res = await decora.Service.Run(endpoint, call, "GET", parameters);

            await Task.Delay(500);

            var post = res["post"];

            postImage.Source = ImageRender.display("post", (string)post["image"]);

            string idUser = Convert.ToString(Convert.ToInt32(post["idUser"]));

            bt_new_message.Clicked += delegate {
                Navigation.PushModalAsync(new PostComment(idPost));
            };

            actionBack.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => {
                    switch (App.lp.page)
                    {
                    case "timeline":
                        App.Current.MainPage = new NavigationPage(new Timeline());
                        break;

                    case "explorer":
                        App.Current.MainPage = new NavigationPage(new Explorer());
                        break;

                    case "category":
                        App.Current.MainPage = new NavigationPage(new Category(Convert.ToInt32(App.lp.page_id)));
                        break;

                    case "profile":

                        IDictionary <string, string> args = new Dictionary <string, string>()
                        {
                            { "idUser", Convert.ToString(App.lp.page_id) },
                            { "module", Convert.ToString(App.lp.module) },
                            { "idModule", Convert.ToString(App.lp.module_id) },
                        };

                        App.Current.MainPage = new NavigationPage(new Profile(args));
                        break;
                    }
                })
            });

            bt_share.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(async() => {
                    await CrossShare.Current.Share(new Plugin.Share.Abstractions.ShareMessage()
                    {
                        Text  = string.Format("Baixe o app Portal Decoração, e veja o projeto {0}, de {1}.", (string)post["title"], (string)post["userName"]),
                        Title = "Portal Decoração"
                    });
                })
            });

            tt_comments.Text = (string)post["tt_comments"];
            tt_likes.Text    = (string)post["tt_likes"];
            postTile.Text    = (string)post["title"];

            count_post.Text = string.Format("FOTO ({0} DE {1})", (string)post["current"], (string)post["total"]);

            if (!string.IsNullOrEmpty((string)post["next"]))
            {
                bt_next.IsVisible = true;
                bt_next.GestureRecognizers.Add(new TapGestureRecognizer
                {
                    Command = new Command(() =>
                    {
                        App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(post["next"])));
                    })
                });
            }

            if (!string.IsNullOrEmpty((string)post["previous"]))
            {
                bt_previous.IsVisible = true;
                bt_previous.GestureRecognizers.Add(new TapGestureRecognizer
                {
                    Command = new Command(() =>
                    {
                        App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(post["previous"])));
                    })
                });
            }


            postCategories.Children.Clear();

            int ttCat = 0;
            int cCat  = 0;

            foreach (var item in res["categories"])
            {
                ttCat++;
            }

            foreach (var item in res["categories"])
            {
                cCat++;

                Label catLabel = new Label
                {
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "OpenSans-Light" :
                                 Device.RuntimePlatform == Device.Android ? "OpenSans-Light.ttf#OpenSans-Light" : "Assets/Fonts/OpenSans-Light.ttf#OpenSans-Light",
                    TextColor = Color.FromHex("#667653"),
                    Text      = (string)item["title"]
                };

                catLabel.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = new Command(() =>
                    {
                        App.Current.MainPage = new NavigationPage(new Category(Convert.ToInt32(item["idCategory"])));
                    })
                });

                postCategories.Children.Add(catLabel);

                if (ttCat > cCat)
                {
                    postCategories.Children.Add(new Label
                    {
                        Text      = ">",
                        TextColor = Color.FromHex("#667653")
                    });
                }
            }
            ;

            postUserImage.Source = ImageRender.display("user", (string)post["imgUser"]);
            postUserImage.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() => {
                    IDictionary <string, string> args = new Dictionary <string, string>()
                    {
                        { "idUser", (string)post["idUser"] },
                        { "module", "general" },
                        { "idModule", null },
                    };

                    App.Current.MainPage = new NavigationPage(new Profile(args));
                })
            });

            postUserName.Text = (string)post["userName"];
            postUserName.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() => {
                    IDictionary <string, string> args = new Dictionary <string, string>()
                    {
                        { "idUser", (string)post["idUser"] },
                        { "module", "general" },
                        { "idModule", null },
                    };

                    App.Current.MainPage = new NavigationPage(new Profile(args));
                })
            });

            postDescription.Text  = (string)post["description"];
            postPhotographer.Text = string.Format("@{0}", (string)post["photographer"]);

            if (Convert.ToInt32(post["ttBooks"]) > 1)
            {
                tt_books.IsVisible = true;
                tt_books.Text      = string.Format("Essa foto foi adicionada a {0} livros de ideias", Convert.ToInt32(post["ttBooks"]));
            }

            await Task.Delay(500);

            // check if is like
            if (Convert.ToInt32(post["liked"]) > 0)
            {
                bt_like.IsVisible        = false;
                bt_like_active.IsVisible = true;
            }
            else
            {
                bt_like.IsVisible        = true;
                bt_like_active.IsVisible = false;
            }

            bt_like.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => {
                    likePost(idPost, true);
                })
            });

            bt_like_active.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => {
                    likePost(Convert.ToInt32(post["idPost"]), false);
                })
            });

            bt_save.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => {
                    Navigation.PushModalAsync(new PostSave(Convert.ToInt32(post["idPost"]), "post", Convert.ToInt32(post["idUser"]), Convert.ToInt32(post["idProject"])));
                })
            });

            string rating = "0";

            if ((int)res["post"]["userTtRating"] > 0)
            {
                rating = Convert.ToString((int)res["post"]["userTtRating"]);
            }

            postTotalRating.Text = string.Format("{0} Avaliações", rating);

            string star;

            for (int i = 0; i < 5; i++)
            {
                star = "star_null";

                if ((float)res["post"]["userRating"] >= (i + 1))
                {
                    star = "star_green";
                }

                block_rating.Children.Add(new Image
                {
                    Source        = star,
                    HeightRequest = 10
                });
            }

            var gridExplorer = new Grid();

            int col = 0;
            int row = 0;

            gridExplorer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            gridExplorer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            gridExplorer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            int tt_posts = 0;

            foreach (var item in res["project"]["posts"])
            {
                tt_posts++;
            }

            if (tt_posts > 0)
            {
                blockOtherPosts.IsVisible     = true;
                blockOtherPosts_div.IsVisible = true;

                for (int i = 0; i < ((tt_posts / 3) + ((tt_posts % 3) > 0 ? 1 : 0)); i++)
                {
                    gridExplorer.RowDefinitions.Add(new RowDefinition {
                        Height = 100
                    });
                }

                int g = 0;
                foreach (var item in res["project"]["posts"])
                {
                    Image explorerImage = new Image
                    {
                        Aspect        = Aspect.AspectFill,
                        HeightRequest = 150,
                        Source        = ImageRender.display("post", (string)item["image"])
                    };

                    explorerImage.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(() =>
                        {
                            App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(item["idPost"])));
                        })
                    });

                    gridExplorer.Children.Add(explorerImage, col, row);

                    if (((g + 1) % 3) == 0)
                    {
                        col = 0;
                        row++;
                    }
                    else if (((g + 1) % 2) == 0)
                    {
                        col = 1;
                    }
                    else
                    {
                        col = 2;
                    }

                    g++;
                }

                otherPosts.Children.Add(gridExplorer);
            }

            StackLayout block_bt_projectlist = new StackLayout
            {
                Padding     = new Thickness(20, 0),
                Margin      = new Thickness(0, 10),
                Orientation = StackOrientation.Horizontal
            };

            Button bt_projectlist = new Button
            {
                FontFamily = Device.RuntimePlatform == Device.iOS ? "OpenSans-Light" :
                             Device.RuntimePlatform == Device.Android ? "OpenSans-Light.ttf#OpenSans-Light" : "Assets/Fonts/OpenSans-Light.ttf#OpenSans-Light",
                WidthRequest      = 300,
                FontSize          = 14,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text = "Ver todos os projetos"
            };

            bt_projectlist.Clicked += delegate
            {
                IDictionary <string, string> args = new Dictionary <string, string>()
                {
                    { "idUser", Convert.ToString(idUser) },
                    { "module", "projectlist" },
                    { "idModule", null },
                };
                App.Current.MainPage = new NavigationPage(new Profile(args));
            };


            block_bt_projectlist.Children.Add(bt_projectlist);
            blockOtherPosts.Children.Add(block_bt_projectlist);



            int ttProjectsRelated = 0;

            foreach (var item in res["projects_related"])
            {
                ttProjectsRelated++;
            }

            if (ttProjectsRelated > 0)
            {
                ProjRelated_block.IsVisible = true;
                ProjRelated_div.IsVisible   = true;

                foreach (var item in res["projects_related"])
                {
                    StackLayout dataProjRelated = new StackLayout
                    {
                        HeightRequest = 150,
                    };

                    BlockProjRelated.Children.Add(dataProjRelated);

                    dataProjRelated.GestureRecognizers.Add(new TapGestureRecognizer
                    {
                        Command = new Command(() => {
                            IDictionary <string, string> args = new Dictionary <string, string>()
                            {
                                { "idUser", Convert.ToString(Convert.ToInt32(item["idUser"])) },
                                { "module", "project" },
                                { "idModule", Convert.ToString(Convert.ToInt32(item["idProject"])) },
                            };
                            App.Current.MainPage = new NavigationPage(new Profile(args));
                        })
                    });

                    RelativeLayout block_rel = new RelativeLayout();

                    dataProjRelated.Children.Add(block_rel);

                    Image categoryImage = new Image
                    {
                        Aspect        = Aspect.AspectFill,
                        HeightRequest = 150,
                        WidthRequest  = 150,
                        Source        = ImageRender.display("post", (string)item["image"])
                    };

                    block_rel.Children.Add(categoryImage,
                                           xConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.X);
                    }),

                                           yConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.Y);
                    })
                                           );
                    BoxView categoryBox = new BoxView
                    {
                        Opacity         = 0.5,
                        BackgroundColor = Color.Black
                    };

                    block_rel.Children.Add(categoryBox,
                                           widthConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.Width);
                    }),

                                           heightConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.Height);
                    }),

                                           xConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.X);
                    }),

                                           yConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.Y);
                    })
                                           );

                    StackLayout projRelatedData = new StackLayout
                    {
                        Orientation = StackOrientation.Vertical
                    };

                    projRelatedData.Children.Add(new Label
                    {
                        Text                    = (string)item["title"],
                        HeightRequest           = 150,
                        WidthRequest            = 150,
                        HorizontalOptions       = LayoutOptions.Center,
                        VerticalOptions         = LayoutOptions.Center,
                        HorizontalTextAlignment = TextAlignment.Center,
                        VerticalTextAlignment   = TextAlignment.Center,
                        FontFamily              = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                                  Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Bold.ttf#Jura-Bold",
                        FontSize  = 21,
                        TextColor = Color.White
                    });

                    block_rel.Children.Add(projRelatedData,
                                           heightConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.Height);
                    }),

                                           xConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.X);
                    }),

                                           yConstraint: Constraint.RelativeToParent((parent) => {
                        return(parent.Y);
                    })
                                           );
                }
            }

            int ttComents = 0;

            foreach (var item in res["comments"])
            {
                ttComents++;
            }

            if (ttComents > 0)
            {
                comments_div.IsVisible   = true;
                comments_title.IsVisible = true;

                foreach (var item in res["comments"])
                {
                    StackLayout commentBlock = new StackLayout
                    {
                        VerticalOptions = LayoutOptions.End,
                        Orientation     = StackOrientation.Horizontal,
                        Spacing         = 0
                    };

                    commentBlock.Children.Add(new CircleImage
                    {
                        WidthRequest      = 50,
                        HeightRequest     = 50,
                        VerticalOptions   = LayoutOptions.Start,
                        BorderColor       = Color.DarkGray,
                        BorderThickness   = 1,
                        Aspect            = Aspect.AspectFill,
                        HorizontalOptions = LayoutOptions.Fill,
                        Source            = ImageRender.display("user", (string)item["imgUser"])
                    });

                    StackLayout commentData = new StackLayout
                    {
                        Padding     = new Thickness(5, 0, 0, 0),
                        Orientation = StackOrientation.Vertical
                    };

                    commentData.Children.Add(new Label
                    {
                        Text           = (string)item["userName"],
                        FontAttributes = FontAttributes.Bold,
                        FontFamily     = Device.RuntimePlatform == Device.iOS ? "OpenSans-SemiboldItalic" :
                                         Device.RuntimePlatform == Device.Android ? "OpenSans-SemiboldItalic.ttf#OpenSans-SemiboldItalic" : "Assets/Fonts/OpenSans-SemiboldItalic.ttf#OpenSans-SemiboldItalic"
                    });

                    commentData.Children.Add(new Label
                    {
                        Text       = (string)item["comment"],
                        FontFamily = Device.RuntimePlatform == Device.iOS ? "OpenSans-LightItalic" :
                                     Device.RuntimePlatform == Device.Android ? "OpenSans-LightItalic.ttf#OpenSans-LightItalic" : "Assets/Fonts/OpenSans-LightItalic.ttf#OpenSans-LightItalic"
                    });

                    commentBlock.Children.Add(commentData);
                    postComments.Children.Add(commentBlock);

                    StackLayout messageDivisor = new StackLayout
                    {
                        Margin = new Thickness(0, 5)
                    };

                    messageDivisor.Children.Add(new BoxView
                    {
                        HeightRequest     = 1,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.EndAndExpand,
                        Color             = Color.FromHex("#e1e1e1")
                    });

                    postComments.Children.Add(messageDivisor);
                }
            }
        }
示例#23
0
        private void makeCategories(dynamic obj)
        {
            StackLayout Categories = new StackLayout();

            Categories.Children.Add(new Label
            {
                Text       = "PROJETO POR CATEGORIA",
                FontSize   = 21,
                Margin     = new Thickness(10, 0, 0, 0),
                FontFamily = Device.RuntimePlatform == Device.iOS ? "OpenSans-Light" :
                             Device.RuntimePlatform == Device.Android ? "OpenSans-Light.ttf#OpenSans-Light" : "Assets/Fonts/OpenSans-Light.ttf#OpenSans-Light"
            });

            StackLayout categoryBlock = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            foreach (var item in obj["categories"])
            {
                StackLayout dataCategory = new StackLayout
                {
                    HeightRequest = 150,
                };

                categoryBlock.Children.Add(dataCategory);

                dataCategory.GestureRecognizers.Add(new TapGestureRecognizer
                {
                    Command = new Command(() => {
                        App.Current.MainPage = new NavigationPage(new Category(Convert.ToInt32((string)item["idCategory"])));
                    })
                });

                RelativeLayout block_rel = new RelativeLayout();

                dataCategory.Children.Add(block_rel);

                Image categoryImage = new Image
                {
                    Aspect        = Aspect.AspectFill,
                    HeightRequest = 150,
                    WidthRequest  = 150,
                    Source        = ImageRender.display("category", (string)item["image"])
                };

                block_rel.Children.Add(categoryImage,
                                       xConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }),

                                       yConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Y);
                })
                                       );
                BoxView categoryBox = new BoxView
                {
                    Opacity         = 0.5,
                    BackgroundColor = Color.Black
                };

                block_rel.Children.Add(categoryBox,
                                       widthConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Width);
                }),

                                       heightConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Height);
                }),

                                       xConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }),

                                       yConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Y);
                })
                                       );

                StackLayout categoryData = new StackLayout
                {
                    Orientation = StackOrientation.Vertical
                };

                categoryData.Children.Add(new Label
                {
                    Text                    = (string)item["title"],
                    HeightRequest           = 150,
                    WidthRequest            = 150,
                    HorizontalOptions       = LayoutOptions.Center,
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontFamily              = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                              Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Bold.ttf#Jura-Bold",
                    FontSize  = 21,
                    TextColor = Color.White
                });

                block_rel.Children.Add(categoryData,
                                       heightConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Height);
                }),

                                       xConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }),

                                       yConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Y);
                })
                                       );
            }

            ScrollView baseCategories = new ScrollView
            {
                Margin      = new Thickness(10),
                Orientation = ScrollOrientation.Horizontal,
                Content     = categoryBlock
            };

            Categories.Children.Add(baseCategories);

            MainContent.Children.Add(Categories);
        }
示例#24
0
        private void makeProfessionals(dynamic obj)
        {
            StackLayout professionals = new StackLayout();

            professionals.Children.Add(new Label
            {
                Text       = "Busque por profissionais",
                FontSize   = 21,
                Margin     = new Thickness(10, 0, 0, 0),
                FontFamily = Device.RuntimePlatform == Device.iOS ? "OpenSans-Light" :
                             Device.RuntimePlatform == Device.Android ? "OpenSans-Light.ttf#OpenSans-Light" : "Assets/Fonts/OpenSans-Light.ttf#OpenSans-Light"
            });

            StackLayout professionalBlock = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            foreach (var item in obj["users"])
            {
                StackLayout dataProfessional = new StackLayout
                {
                    HeightRequest = 250,
                };

                professionalBlock.Children.Add(dataProfessional);

                RelativeLayout block_rel = new RelativeLayout();

                block_rel.GestureRecognizers.Add(new TapGestureRecognizer
                {
                    Command = new Command(() => {
                        IDictionary <string, string> args = new Dictionary <string, string>()
                        {
                            { "idUser", Convert.ToString(item["idUser"]) },
                            { "module", "general" },
                            { "idModule", null },
                        };
                        App.Current.MainPage = new NavigationPage(new Profile(args));
                    })
                });

                dataProfessional.Children.Add(block_rel);

                Image professionalImage = new Image
                {
                    Aspect        = Aspect.AspectFill,
                    HeightRequest = 250,
                    WidthRequest  = 150,
                    Source        = ImageRender.display("cover", (string)item["cover"])
                };

                block_rel.Children.Add(professionalImage,
                                       xConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }),

                                       yConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Y);
                })
                                       );
                BoxView categoryBox = new BoxView
                {
                    Opacity         = 0.5,
                    BackgroundColor = Color.Black
                };

                block_rel.Children.Add(categoryBox,
                                       widthConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Width);
                }),

                                       heightConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Height);
                }),

                                       xConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }),

                                       yConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Y);
                })
                                       );

                StackLayout professionalData = new StackLayout
                {
                    Orientation = StackOrientation.Vertical
                };

                professionalData.Children.Add(new CircleImage
                {
                    WidthRequest      = 60,
                    HeightRequest     = 60,
                    BorderThickness   = 1,
                    VerticalOptions   = LayoutOptions.End,
                    HorizontalOptions = LayoutOptions.Center,
                    BorderColor       = Color.White,
                    Aspect            = Aspect.AspectFill,
                    Source            = ImageRender.display("user", (string)item["image"])
                });

                professionalData.Children.Add(new Label
                {
                    Text                    = (string)item["userName"],
                    WidthRequest            = 150,
                    HorizontalOptions       = LayoutOptions.Center,
                    VerticalOptions         = LayoutOptions.End,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.End,
                    FontFamily              = Device.RuntimePlatform == Device.iOS ? "OpenSans-CondBold" :
                                              Device.RuntimePlatform == Device.Android ? "OpenSans-CondBold.ttf#OpenSans-CondBold" : "Assets/Fonts/OpenSans-CondBold.ttf#OpenSans-CondBold",
                    FontSize  = 16,
                    TextColor = Color.White
                });

                block_rel.Children.Add(professionalData,
                                       xConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.X);
                }),

                                       yConstraint: Constraint.RelativeToParent((parent) => {
                    return(parent.Height - 120);
                })
                                       );
            }

            ScrollView baseProfessionals = new ScrollView
            {
                Margin      = new Thickness(10),
                Orientation = ScrollOrientation.Horizontal,
                Content     = professionalBlock
            };

            professionals.Children.Add(baseProfessionals);

            MainContent.Children.Add(professionals);
        }
示例#25
0
        private void makeMenu()
        {
            StackLayout logo = new StackLayout
            {
                Orientation   = StackOrientation.Horizontal,
                HeightRequest = 55,
                Spacing       = 0
            };

            Image imgLogo = new Image
            {
                Source            = "logo_branco",
                HeightRequest     = 40,
                WidthRequest      = 94,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(-5)
            };

            logo.Children.Add(imgLogo);

            MainRelative.Children.Add(logo,

                                      xConstraint: Constraint.RelativeToParent((parent) =>
            {
                return(parent.X);
            }),

                                      yConstraint: Constraint.RelativeToParent((parent) =>
            {
                return(parent.Y);
            }),

                                      widthConstraint: Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }));

            StackLayout menuBar = new StackLayout
            {
                Orientation   = StackOrientation.Horizontal,
                HeightRequest = 55
            };

            StackLayout menu = new StackLayout
            {
                Padding           = new Thickness(15, 10),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Image imgMenu = new Image
            {
                Source        = "menu_white",
                HeightRequest = 35
            };

            imgMenu.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(openMenu)
            });

            menu.Children.Add(imgMenu);

            menuBar.Children.Add(menu);

            StackLayout explorer = new StackLayout
            {
                Padding           = new Thickness(5, 15),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            Image imgExplorer = new Image
            {
                Source        = "lupa",
                HeightRequest = 30
            };

            imgExplorer.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(goToExplorer)
            });

            explorer.Children.Add(imgExplorer);

            menuBar.Children.Add(explorer);

            string id  = Settings.config_user;
            string img = Settings.config_image;

            StackLayout avatar = new StackLayout
            {
                Padding           = new Thickness(5, 10, 10, 10),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.End
            };

            CircleImage imgAvatar = new CircleImage
            {
                Source          = ImageRender.display("user", img),
                HeightRequest   = 40,
                Aspect          = Aspect.AspectFill,
                WidthRequest    = 40,
                BorderColor     = Color.White,
                BorderThickness = 1
            };

            imgAvatar.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() => {
                    IDictionary <string, string> args = new Dictionary <string, string>()
                    {
                        { "idUser", id },
                        { "module", "general" },
                        { "idModule", null },
                    };
                    App.Current.MainPage = new NavigationPage(new Profile(args));
                })
            });

            avatar.Children.Add(imgAvatar);

            menuBar.Children.Add(avatar);

            MainRelative.Children.Add(menuBar,

                                      xConstraint: Constraint.RelativeToParent((parent) =>
            {
                return(parent.X);
            }),

                                      yConstraint: Constraint.RelativeToParent((parent) =>
            {
                return(parent.Y);
            }),

                                      widthConstraint: Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }));
        }
示例#26
0
        private void makePost(dynamic obj, bool main)
        {
            bool validate;
            int  c = 0;

            try
            {
                var post = obj["posts"][(main ? 1 : 0)];
                validate = true;
                if (!actionScroll)
                {
                    scrollTimeline.Scrolled += checkScroll;
                }
            }
            catch
            {
                validate = false;
            }

            if (validate)
            {
                foreach (var item in obj["posts"])
                {
                    if (c > (!main ? -1 : 0))
                    {
                        /*
                         * if (counterPost % 10 == 0)
                         *  makeAds();
                         *
                         * if (counterPost % 8 == 0)
                         *  makeCarrousel(obj);
                         */
                        StackLayout postBlock = new StackLayout
                        {
                            HeightRequest = 350,
                        };

                        RelativeLayout rel = new RelativeLayout();

                        postBlock.Children.Add(rel);

                        Image imgPost = new Image
                        {
                            Aspect        = Aspect.AspectFill,
                            HeightRequest = 350,
                            Source        = ImageRender.display("post", (string)item["imgPost"]),
                            Margin        = new Thickness(15)
                        };

                        rel.Children.Add(imgPost,
                                         widthConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.Width);
                        }),

                                         heightConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.Height);
                        })
                                         );

                        BoxView boxlight = new BoxView
                        {
                            Opacity         = 0.6,
                            BackgroundColor = Color.Black,
                            Margin          = new Thickness(15),
                            HeightRequest   = 60
                        };

                        rel.Children.Add(boxlight,
                                         widthConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.Width);
                        }),

                                         xConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.X);
                        }),

                                         yConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.Height - 90);
                        })
                                         );

                        StackLayout dataPost = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            Margin      = new Thickness(15, 0)
                        };

                        dataPost.Children.Add(new Label
                        {
                            Text = (string)item["title"],
                            HorizontalOptions = LayoutOptions.StartAndExpand,
                            FontSize          = 18,
                            FontFamily        = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                                Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Bold.ttf#Jura-Bold",
                            HorizontalTextAlignment = TextAlignment.Start,
                            Margin    = new Thickness(10, 11, 0, 0),
                            TextColor = Color.White
                        });

                        dataPost.Children.Add(new Image
                        {
                            Source            = "plus",
                            HorizontalOptions = LayoutOptions.End,
                            Margin            = new Thickness(0, 15, 20, 0)
                        });

                        rel.Children.Add(dataPost,
                                         widthConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.Width);
                        }),

                                         xConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.X);
                        }),

                                         yConstraint: Constraint.RelativeToParent((parent) =>
                        {
                            return(parent.Height - 70);
                        })
                                         );

                        postBlock.GestureRecognizers.Add(new TapGestureRecognizer
                        {
                            Command = new Command(() =>
                            {
                                App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(item["idPost"])));
                            })
                        });

                        MainContent.Children.Add(postBlock);

                        makeDivisor();

                        counterPost++;
                    }

                    c++;
                }
            }

            executing = false;
        }
示例#27
0
        private void makeMainPost(dynamic obj)
        {
            try
            {
                Image imgBg = new Image
                {
                    Aspect = Aspect.AspectFill,
                    Source = ImageRender.display("post", (string)obj["posts"][0]["imgPost"])
                };

                MainRelative.Children.Add(imgBg,
                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width);
                }),

                                          heightConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height);
                })
                                          );

                BoxView boxlight = new BoxView
                {
                    Opacity         = 0.6,
                    BackgroundColor = Color.Black
                };

                MainRelative.Children.Add(boxlight,
                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width);
                }),

                                          heightConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height);
                }),

                                          xConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.X);
                }),

                                          yConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Y);
                })
                                          );

                Label title = new Label
                {
                    Text       = "SUA MELHOR REFERÊNCIA EM ARQUITETURA, DECORAÇÃO, PAISAGISMO E DESIGN",
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                 Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Medium.ttf#Jura-Bold",
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalOptions       = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Center,
                    TextColor = Color.White,
                    FontSize  = 37
                };

                MainRelative.Children.Add(title,

                                          xConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.X + 15);
                }),

                                          yConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Y);
                }),

                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width - 30);
                }),

                                          heightConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height - 20);
                })
                                          );

                StackLayout projectBlock = new StackLayout
                {
                    Margin      = new Thickness(15, 0),
                    Orientation = StackOrientation.Horizontal
                };

                Label titleProject = new Label
                {
                    Text                    = string.Format("Projeto de {0}", (string)obj["posts"][0]["userName"]),
                    FontSize                = 18,
                    HorizontalOptions       = LayoutOptions.EndAndExpand,
                    HorizontalTextAlignment = TextAlignment.End,
                    Margin                  = new Thickness(0, 13, 3, 0),
                    TextColor               = Color.White,
                    FontFamily              = Device.RuntimePlatform == Device.iOS ? "OpenSans-Italic" :
                                              Device.RuntimePlatform == Device.Android ? "OpenSans-Italic.ttf#OpenSans-Light" : "Assets/Fonts/OpenSans-Italic.ttf#OpenSans-Italic"
                };

                titleProject.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = new Command(() =>
                    {
                        App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(obj["posts"][0]["idPost"])));
                    })
                });

                projectBlock.Children.Add(titleProject);

                CircleImage imgProject = new CircleImage
                {
                    Source            = ImageRender.display("user", (string)obj["posts"][0]["imgUser"]),
                    BorderColor       = Color.White,
                    HeightRequest     = 50,
                    WidthRequest      = 50,
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Center,
                    BorderThickness   = 1,
                    Aspect            = Aspect.AspectFill
                };

                imgProject.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = new Command(() =>
                    {
                        App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(obj["posts"][0]["idPost"])));
                    })
                });

                projectBlock.Children.Add(imgProject);

                MainRelative.Children.Add(projectBlock,

                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width);
                }),

                                          xConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.X);
                }),

                                          yConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height - 70);
                })
                                          );
            }
            catch
            {
                Image imgBg = new Image
                {
                    Aspect = Aspect.AspectFill,
                    Source = ImageRender.display("post", "img7.png")
                };

                MainRelative.Children.Add(imgBg,
                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width);
                }),

                                          heightConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height);
                })
                                          );

                BoxView boxlight = new BoxView
                {
                    Opacity         = 0.8,
                    BackgroundColor = Color.Black
                };

                MainRelative.Children.Add(boxlight,
                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width);
                }),

                                          heightConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height);
                }),

                                          xConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.X);
                }),

                                          yConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Y);
                })
                                          );

                StackLayout boxText = new StackLayout
                {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center
                };

                Label title = new Label
                {
                    Text       = "Bem-vindo! Explore e siga os profissionais para preencher a sua timeline.",
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                 Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Medium.ttf#Jura-Bold",
                    HorizontalTextAlignment = TextAlignment.Center,
                    TextColor = Color.White,
                    FontSize  = 24
                };

                Button btExplorer = new Button
                {
                    Text            = "EXPLORAR",
                    TextColor       = Color.White,
                    BorderColor     = Color.White,
                    FontAttributes  = FontAttributes.Bold,
                    BorderWidth     = 3,
                    BackgroundColor = Color.Transparent,
                    FontSize        = 21,
                    FontFamily      = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                      Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Medium.ttf#Jura-Bold",
                    Margin = new Thickness(20, 0, 0, 0)
                };

                btExplorer.Clicked += delegate
                {
                    goToExplorer();
                };

                boxText.Children.Add(title);
                boxText.Children.Add(btExplorer);

                MainRelative.Children.Add(boxText,

                                          xConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.X + 15);
                }),

                                          yConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Y);
                }),

                                          widthConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width - 30);
                }),

                                          heightConstraint: Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height - 20);
                })
                                          );
            }

            makeMenu();
        }
示例#28
0
        public async void makeBlog(bool Load = false, string arg = "", bool init = false)
        {
            contentIndicator.IsVisible = true;

            string endpoint = "portalib-dev-blog";

            IDictionary <string, string> parameters;

            if (!Load)
            {
                parameters = new Dictionary <string, string>()
                {
                    { "idCategory", Convert.ToString(categoryId) }
                };
            }
            else
            {
                parameters = new Dictionary <string, string>()
                {
                    { "idCategory", Convert.ToString(categoryId) },
                    { "ignoreClear", "true" }
                };
            }

            IDictionary <string, string> call = new Dictionary <string, string>
            {
                { "act", "list" },
                { "mod", "blog" }
            };

            dynamic res = await decora.Service.Run(endpoint, call, "GET", parameters);

            int tt = 0;

            foreach (var item in res)
            {
                tt++;
            }

            category_tt.Text    = Convert.ToString(tt);
            category_title.Text = categoryName;

            if (tt > 0)
            {
                foreach (var item in res)
                {
                    StackLayout postBlock = new StackLayout
                    {
                        HeightRequest = 200,
                    };

                    RelativeLayout rel = new RelativeLayout();

                    postBlock.Children.Add(rel);

                    Image imgPost = new Image
                    {
                        Aspect        = Aspect.AspectFill,
                        HeightRequest = 200,
                        Source        = ImageRender.display("blog", (string)item["image"]),
                        Margin        = new Thickness(5)
                    };

                    rel.Children.Add(imgPost,
                                     widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                     heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    })
                                     );

                    BoxView boxlight = new BoxView
                    {
                        Opacity         = 0.3,
                        BackgroundColor = Color.Black,
                        Margin          = new Thickness(5),
                        HeightRequest   = 60
                    };

                    rel.Children.Add(boxlight,
                                     widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),
                                     heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    }),

                                     xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.X);
                    }),

                                     yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Y);
                    })
                                     );

                    StackLayout dataPost = new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Center,
                        Margin            = new Thickness(5, 0)
                    };

                    dataPost.Children.Add(new Label
                    {
                        Text = (string)item["title"],
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Center,
                        FontSize          = 18,
                        FontFamily        = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                            Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Bold.ttf#Jura-Bold",
                        HorizontalTextAlignment = TextAlignment.Center,
                        TextColor = Color.White
                    });

                    rel.Children.Add(dataPost,
                                     widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                     xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.X);
                    }),

                                     yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Y);
                    }),

                                     heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    })
                                     );

                    postBlock.GestureRecognizers.Add(new TapGestureRecognizer
                    {
                        Command = new Command(() =>
                        {
                            App.Current.MainPage = new NavigationPage(new Blog(Convert.ToInt32(item["idBlog"])));
                        })
                    });

                    pageContent.Children.Add(postBlock);
                }
            }

            contentIndicator.IsVisible = false;
        }
示例#29
0
        public async void makeBlog()
        {
            string endpoint = "portalib-dev-blog";

            IDictionary <string, int> parameters = new Dictionary <string, int>()
            {
                { "idBlog", blogId }
            };

            IDictionary <string, string> call = new Dictionary <string, string>
            {
                { "act", "data" },
                { "mod", "blog" }
            };

            dynamic res = await decora.Service.Run(endpoint, call, "GET", parameters);

            var blog = res["blog"];

            blog_img.Source = ImageRender.display("blog", (string)blog["image"]);
            blog_title.Text = (string)blog["title"];
            blog_desc.Text  = (string)blog["description"];
            blog_users.Text = (string)blog["users"];

            var comments = res["comments"];

            int c = 0;

            foreach (var item in comments)
            {
                c++;
            }

            if (c > 0)
            {
                block_comment.IsVisible     = true;
                block_comment_div.IsVisible = true;
                title_comments.Text         = string.Format("{0} Comentário{1}", c, (c > 1 ? "s" : ""));

                foreach (var item in comments)
                {
                    StackLayout stk = new StackLayout
                    {
                        VerticalOptions = LayoutOptions.End,
                        Orientation     = StackOrientation.Horizontal,
                        Spacing         = 0
                    };

                    CircleImage img = new CircleImage
                    {
                        Source            = ImageRender.display("user", (string)item["imgUser"]),
                        HeightRequest     = 50,
                        WidthRequest      = 50,
                        VerticalOptions   = LayoutOptions.Start,
                        BorderColor       = Color.DarkGray,
                        BorderThickness   = 1,
                        HorizontalOptions = LayoutOptions.Fill,
                        Aspect            = Aspect.AspectFill
                    };

                    stk.Children.Add(img);

                    StackLayout stkData = new StackLayout
                    {
                        Orientation = StackOrientation.Vertical,
                        Padding     = new Thickness(5, 0, 0, 0)
                    };

                    stkData.Children.Add(new Label
                    {
                        Text           = (string)item["userName"],
                        FontAttributes = FontAttributes.Bold,
                        FontFamily     = Device.RuntimePlatform == Device.iOS ? "OpenSans-Semibold" :
                                         Device.RuntimePlatform == Device.Android ? "OpenSans-Semibold.ttf#OpenSans-Semibold" : "Assets/Fonts/OpenSans-Semibold.ttf#OpenSans-Semibold"
                    });

                    stkData.Children.Add(new Label
                    {
                        Text       = (string)item["comment"],
                        FontFamily = Device.RuntimePlatform == Device.iOS ? "OpenSans-LightItalic" :
                                     Device.RuntimePlatform == Device.Android ? "OpenSans-LightItalic.ttf#OpenSans-LightItalic" : "Assets/Fonts/OpenSans-LightItalic.ttf#OpenSans-LightItalic"
                    });

                    stk.Children.Add(stkData);

                    block_comment.Children.Add(stk);
                }
            }

            var related = res["blog_related"];

            c = 0;

            foreach (var item in related)
            {
                c++;
            }

            if (c > 0)
            {
                block_related.IsVisible     = true;
                block_related_div.IsVisible = true;

                foreach (var item in related)
                {
                    StackLayout postBlock = new StackLayout
                    {
                        HeightRequest = 200,
                    };

                    RelativeLayout rel = new RelativeLayout();

                    postBlock.Children.Add(rel);

                    Image imgPost = new Image
                    {
                        Aspect        = Aspect.AspectFill,
                        HeightRequest = 200,
                        Source        = ImageRender.display("blog", (string)item["image"]),
                        Margin        = new Thickness(5)
                    };

                    rel.Children.Add(imgPost,
                                     widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                     heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    })
                                     );

                    BoxView boxlight = new BoxView
                    {
                        Opacity         = 0.3,
                        BackgroundColor = Color.Black,
                        Margin          = new Thickness(5),
                        HeightRequest   = 60
                    };

                    rel.Children.Add(boxlight,
                                     widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),
                                     heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    }),

                                     xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.X);
                    }),

                                     yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Y);
                    })
                                     );

                    StackLayout dataPost = new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Center,
                        Margin            = new Thickness(5, 0)
                    };

                    dataPost.Children.Add(new Label
                    {
                        Text = (string)item["title"],
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Center,
                        FontSize          = 18,
                        FontFamily        = Device.RuntimePlatform == Device.iOS ? "Jura-Bold" :
                                            Device.RuntimePlatform == Device.Android ? "Jura-Bold.ttf#Jura-Bold" : "Assets/Fonts/Jura-Bold.ttf#Jura-Bold",
                        HorizontalTextAlignment = TextAlignment.Center,
                        TextColor = Color.White
                    });

                    rel.Children.Add(dataPost,
                                     widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                     xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.X);
                    }),

                                     yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Y);
                    }),

                                     heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    })
                                     );

                    postBlock.GestureRecognizers.Add(new TapGestureRecognizer
                    {
                        Command = new Command(() =>
                        {
                            App.Current.MainPage = new NavigationPage(new Blog(Convert.ToInt32(item["idBlog"])));
                        })
                    });

                    block_related.Children.Add(postBlock);
                }
            }
        }
示例#30
0
        public async void makeExplorer(bool Load = false, string arg = "", bool init = false)
        {
            contentIndicator.IsVisible = true;

            string endpoint = "portalib-dev-general";

            IDictionary <string, string> parameters;

            if (!Load)
            {
                parameters = new Dictionary <string, string>()
                {
                    { "idUser", (string)Settings.config_user },
                    { "arg", arg }
                };

                gridExplorer.Children.Clear();
                scrollExplorer.Scrolled += checkScroll;

                if (init)
                {
                    gridExplorer.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                    gridExplorer.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                    gridExplorer.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                }
            }
            else
            {
                parameters = new Dictionary <string, string>()
                {
                    { "idUser", (string)Settings.config_user },
                    { "arg", arg },
                    { "ignoreClear", "true" }
                };
            }

            IDictionary <string, string> call = new Dictionary <string, string>
            {
                { "act", "explorer" },
                { "mod", "general" }
            };

            dynamic res = await decora.Service.Run(endpoint, call, "GET", parameters);

            int tt = 0;

            foreach (var item in res)
            {
                tt++;
            }

            if (tt > 0)
            {
                txtEmpty.IsVisible = false;

                foreach (var item in res)
                {
                    if (((c + 1) % 3) == 0)
                    {
                        gridExplorer.RowDefinitions.Add(new RowDefinition {
                            Height = 120
                        });
                    }

                    Image explorerImage = new Image
                    {
                        Aspect        = Aspect.AspectFill,
                        HeightRequest = 150,
                        Source        = ImageRender.display("post", (string)item["image"])
                    };

                    explorerImage.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(() => {
                            App.Current.MainPage = new NavigationPage(new Post(Convert.ToInt32(item["idPost"])));
                        })
                    });

                    gridExplorer.Children.Add(explorerImage, col, row);

                    if (((c + 1) % 3) == 0)
                    {
                        col = 0;
                        row++;
                    }
                    else if (((c + 1) % 2) == 0)
                    {
                        col = 1;
                    }
                    else
                    {
                        col = 2;
                    }

                    c++;
                }

                //if (!Load)
                //pageContent.Children.Add(gridExplorer);
            }
            else
            {
                txtEmpty.IsVisible = true;
            }

            contentIndicator.IsVisible = false;
        }
示例#31
0
        public async void makeCategory(bool Load = false, string arg = "", bool init = false)
        {
            contentIndicator.IsVisible = true;

            string endpoint = "portalib-dev-category";

            IDictionary <string, string> parameters;

            if (!Load)
            {
                parameters = new Dictionary <string, string>()
                {
                    { "", "" }
                };
            }
            else
            {
                parameters = new Dictionary <string, string>()
                {
                    { "ignoreClear", "true" }
                };
            }

            IDictionary <string, string> call = new Dictionary <string, string>
            {
                { "act", "list" },
                { "mod", "category" }
            };

            dynamic res = await decora.Service.Run(endpoint, call, "GET", parameters);

            int tt = 0;

            foreach (var item in res)
            {
                tt++;
            }

            if (tt > 0)
            {
                foreach (var item in res)
                {
                    StackLayout CategoryBlock = new StackLayout
                    {
                        HeightRequest = 200,
                        Spacing       = 0
                    };

                    RelativeLayout block_rel = new RelativeLayout();

                    CategoryBlock.Children.Add(block_rel);

                    Image projectImage = new Image
                    {
                        Aspect        = Aspect.AspectFill,
                        HeightRequest = 200,
                        Source        = ImageRender.display("category", (string)item["image"])
                    };

                    block_rel.Children.Add(projectImage,
                                           widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                           heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height);
                    })
                                           );

                    BoxView projectBox = new BoxView
                    {
                        Opacity         = 0.6,
                        BackgroundColor = Color.Black
                    };


                    block_rel.Children.Add(projectBox,
                                           widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                           heightConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height - (parent.Height - 50));
                    }),

                                           xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.X);
                    }),

                                           yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height - 50);
                    })
                                           );

                    StackLayout projectData = new StackLayout
                    {
                        Orientation = StackOrientation.Vertical,
                        Margin      = new Thickness(10, 0, 0, 0)
                    };

                    projectData.Children.Add(new Label
                    {
                        Text = (string)item["title"],
                        HorizontalOptions       = LayoutOptions.StartAndExpand,
                        HorizontalTextAlignment = TextAlignment.Start,
                        Margin     = new Thickness(5, 0),
                        FontFamily = Device.RuntimePlatform == Device.iOS ? "Jura-Medium" :
                                     Device.RuntimePlatform == Device.Android ? "Jura-Medium.ttf#Jura-Medium" : "Assets/Fonts/Jura-Medium.ttf#Jura-Medium",
                        FontSize  = 12,
                        TextColor = Color.White
                    });

                    projectData.Children.Add(new Label
                    {
                        Text = string.Format("{0} Foto{1}", (string)item["tt"], (Convert.ToInt32(item["tt"]) == 1 ? "" : "s")),
                        HorizontalOptions       = LayoutOptions.StartAndExpand,
                        HorizontalTextAlignment = TextAlignment.Start,
                        Margin     = new Thickness(5, 0),
                        FontFamily = Device.RuntimePlatform == Device.iOS ? "Jura-Medium" :
                                     Device.RuntimePlatform == Device.Android ? "Jura-Medium.ttf#Jura-Medium" : "Assets/Fonts/Jura-Medium.ttf#Jura-Medium",
                        FontSize  = 9,
                        TextColor = Color.White
                    });


                    block_rel.Children.Add(projectData,
                                           widthConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Width);
                    }),

                                           xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.X);
                    }),

                                           yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return(parent.Height - 45);
                    })
                                           );

                    CategoryBlock.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(() =>
                        {
                            App.Current.MainPage = new NavigationPage(new Category(Convert.ToInt32(item["idCategory"])));
                        })
                    });

                    pageContent.Children.Add(CategoryBlock);
                }
            }

            contentIndicator.IsVisible = false;
        }