示例#1
0
        public BlogAll()
        {
            InitializeComponent();

            makeBlog(false, "", true);

            img_main.Source = ImageRender.display("post", "img6.png");
        }
示例#2
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");
        }
示例#3
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"]);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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);
            }));
        }
示例#7
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;
        }
示例#8
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();
        }
示例#9
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;
        }
示例#10
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;
        }
示例#11
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);
                }
            }
        }
示例#12
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;
        }
示例#13
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);
                }
            }
        }