Beispiel #1
0
        public void SeeAllFriends()
        {
            List <UserFriends> userFriendsList = userFriendDataAccess.GetAllFriends(App.UserEmail).ToList();

            if (userFriendsList.Count == 0)
            {
                Label label = new Label()
                {
                    Text              = "You don't have any friends yet",
                    FontSize          = 22,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    Margin            = new Thickness(0, 0, 0, 200)
                };
                MyStackLayout.Children.Add(label);
                return;
            }
            foreach (UserFriends userFriend in userFriendsList)
            {
                user = userDataAccess.GetUserByEmail(userFriend.FriendEmail);
                Frame frame = new Frame()
                {
                    CornerRadius = 10
                };
                StackLayout stackLayout = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal
                };

                Image userPhoto = new Image {
                    Source        = user.UserPhoto,
                    HeightRequest = 50
                };
                stackLayout.Children.Add(userPhoto);

                Label label1 = new Label()
                {
                    FontSize          = 23,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand
                };
                label1.Text = user.UserName;
                stackLayout.Children.Add(label1);

                Button button = new Button()
                {
                    CornerRadius      = 15,
                    BackgroundColor   = Color.FromHex("#c62828"),
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };
                button.Text     = "Unfollow";
                button.Clicked += UnfollowButtonClicked;
                stackLayout.Children.Add(button);
                frame.Content = stackLayout;
                MyStackLayout.Children.Add(frame);
            }
        }
        public void UpdatePage()
        {
            List <UserFriends> users = userFriendataAccess.GetAllFriends(App.UserEmail);

            for (int i = 0; i < users.Count; i++)
            {
                List <UserBook> friendBooks = userBookDataAccess.GetAllBookUser(users[i].FriendEmail);
                AddingActivity(friendBooks, users[i].FriendEmail);
            }
            List <UserBook> userBooks = userBookDataAccess.GetAllBookUser(App.UserEmail);

            AddingActivity(userBooks, App.UserEmail);
        }