Exemplo n.º 1
0
        public FriendProfilePage(Account user, int activeFriendRequest, FriendRequest friendRequest = null)
        {
            //activeFriendRequest key 0 = not friends 1 = pending request from them 2 =friends 3= pending request from you

            ch = new ColorHandler();
            this.activeFriendRequest = activeFriendRequest;
            this.friendRequest = friendRequest;
            this.user = user;
            BackgroundColor = ch.fromStringToColor("purple");
            this.ToolbarItems.Add(new ToolbarItem
            {
                Icon = "Settings_Top.png",

                Order = ToolbarItemOrder.Primary,
                Command = new Command(() => menuPopup())
            });

            this.Padding = new Thickness(0, Device.OnPlatform(10, 0, 0), 0, 0);
            updateView();

        }
Exemplo n.º 2
0
        /// Make a friend request to another user; returns true if request is made, false if one exists already
        /// TODO: what if a user who has a pending fr req sends one to someone who already sent him one? rows flipped?
        /// TODO: make sure you can't friend yourself? is that even an option?
        public async Task<bool> CreateFriendRequest(string recipientId)
        {
            var list = await friendRequestTable.Where(item => item.AuthorId == User.Id && item.RecipientId == recipientId).ToListAsync();

            if (list.Count > 0)
            {
                return false;
            }
            else
            {
                FriendRequest friendRequest = new FriendRequest(User.Id, recipientId);
                await friendRequestTable.InsertAsync(friendRequest);

                return true;
            }
        }