public ClubChatPage(ParentFrontClub club, List<DBItem> chatList, List<Account> commentUsers, List<Account> requestUsersList, bool isMember) { this.isMember = isMember; this.club = club; ch = new ColorHandler(); this.BackgroundColor = Color.Black; this.Title = club.Title; this.ToolbarItems.Add(new ToolbarItem { Icon = "Settings_Top.png", Order = ToolbarItemOrder.Primary, Command = new Command(() => menuPopup()) }); this.commentsList = new ObservableCollection<FrontComment>(); int clubRequestCount = 0; for (int i = 0; i < chatList.Count; i++) { if (chatList[i].GetType() == typeof(Comment)) { if (commentUsers[i] != null) { this.commentsList.Add(new FrontComment((Comment)chatList[i], commentUsers[i - clubRequestCount])); } } else if (chatList[i].GetType() == typeof(ClubRequest)) { this.commentsList.Add(new FrontComment((ClubRequest)chatList[i], requestUsersList[clubRequestCount], this.isMember)); clubRequestCount++; } } CurrentCommentsList = this.commentsList; updatePage(); }
public ChatInfoPage(List<Tag> tagsList, ParentFrontClub club, List<FrontClubMember> usersList, bool isMember, string founderUsername, int previousRating) { this.previousRating = previousRating; starTap = new TapGestureRecognizer(); starTap.Tapped += StarTap_Tapped; this.tagsList = tagsList; this.founderUsername = founderUsername; this.isMember = isMember; this.club = club; this.usersList = usersList; currentPage = "tags"; ch = new ColorHandler(); Title = "Info"; bottomButton = new Button(); BackgroundColor = ch.fromStringToColor("white"); starImages = new List<Image>(); for (int i = 0; i < 5; i++) { Image star = new Image { Aspect = Aspect.AspectFit, HeightRequest = 60, BackgroundColor = ch.fromStringToColor("white"), HorizontalOptions = LayoutOptions.FillAndExpand }; if (i <= previousRating) { star.Source = ImageSource.FromFile(ch.getStarColorString(club.clubColor)); } else { star.Source = ImageSource.FromFile(ch.getStarColorString("gray")); } if (isMember) { star.GestureRecognizers.Add(starTap); } starImages.Add(star); } bSubscribe = new Button { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Text = "Subscribe", FontAttributes = FontAttributes.Bold, BackgroundColor = ch.fromStringToColor("green"), BorderRadius = 15, HeightRequest = 40 }; bSubscribe.Clicked += BSubscribe_Clicked; bUnsubscribe = new Button { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Text = "Unsubscribe", FontAttributes = FontAttributes.Bold, TextColor = ch.fromStringToColor("white"), BackgroundColor = ch.fromStringToColor("gray"), BorderRadius = 15, HeightRequest = 40 }; bUnsubscribe.Clicked += BUnsubscribe_Clicked; if (isMember) { this.bottomButton = bUnsubscribe; } else bottomButton = bSubscribe; bTags = new Button { Text = "Tags", TextColor = ch.fromStringToColor("red"), BackgroundColor = ch.fromStringToColor("white"), HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 0, BorderColor = ch.fromStringToColor("gray") }; bTags.Clicked += BTags_Clicked; bRating = new Button { Text = "Rating", TextColor = ch.fromStringToColor("gray"), BackgroundColor = ch.fromStringToColor("white"), BorderRadius = 0, BorderColor = ch.fromStringToColor("gray"), HorizontalOptions = LayoutOptions.FillAndExpand }; bRating.Clicked += BRating_Clicked; MessagingCenter.Subscribe<ClubMemberViewCell, FrontClubMember>(this, "friendsProfilePage", async (sender, args) => { var acc = (FrontClubMember)args; var account = await App.dbWrapper.GetAccount(acc.Id); int friendship = await App.dbWrapper.GetFriendship(acc.Id); var friendRequests = await App.dbWrapper.GetFriendRequests(); for (int i = 0; i < friendRequests.Count; i++) { if (friendship == 1) { if (friendRequests[i].AuthorId != acc.Id) { friendship = 1; } else { friendship = 3; } } } var accountPage = new FriendProfilePage(account, friendship); await Navigation.PushAsync(accountPage); }); updatePage(); }