public FindPeopleControl(bool friendsByDefault) { this.Padding = new Thickness(0); this.BackgroundColor = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorBackground : Config.ColorGrayBackground; StackLayout stack = new StackLayout(); stack.Orientation = StackOrientation.Vertical; stack.Spacing = 0; this.Content = stack; var myAthlete = App.Repository.GetMyAthlete(); /// Filters /// // community this.communitySelectorControl = new CommunitySelectorControl() { NameAsCommunity = false, AllowFriendsSelection = Config.App != MobileAppEnum.SnookerForVenues }; if (friendsByDefault) { this.communitySelectorControl.Selection = CommunitySelection.CreateFriendsOnly(); } this.communitySelectorControl.SelectionChanged += communitySelectorControl_SelectionChanged; stack.Children.Add(new StackLayout() { Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5), HeightRequest = Config.LargeButtonsHeight,// 40, Spacing = 1, BackgroundColor = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorBackground : Config.ColorGrayBackground, Children = { communitySelectorControl, } }); // search this.buttonClearFilters = new BybButton() { Text = "x", Style = (Style)App.Current.Resources["SimpleButtonStyle"], WidthRequest = 30, TextColor = Config.App == MobileAppEnum.SnookerForVenues ? Color.White : Color.Black, }; this.buttonClearFilters.Clicked += (s, e) => { this.ignoreUIEvents = true; this.entrySearch.Text = ""; this.ignoreUIEvents = false; this.reloadAsync(); }; this.entrySearch = new BybNoBorderEntry() { Placeholder = "Search by name", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, BackgroundColor = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorBackground : Color.White, TextColor = Config.App == MobileAppEnum.SnookerForVenues ? Color.White : Color.Black, }; this.entrySearch.Completed += entrySearch_Completed; stack.Children.Add(new StackLayout() { Orientation = StackOrientation.Horizontal, Padding = new Thickness(Config.IsIOS ? 15 : 5, 0, 0, 0), HeightRequest = Config.LargeButtonsHeight,//40, Spacing = 1, BackgroundColor = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorBackground : Color.White, Children = { entrySearch, buttonClearFilters, } }); /// Status panel /// this.labelStatus = new BybLabel() { HorizontalOptions = LayoutOptions.Center, TextColor = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorTextOnBackgroundGrayed : Color.Black, }; this.buttonSearchWorldwide = new BybButton() { Text = "Search world-wide", Style = (Style)App.Current.Resources["SimpleButtonStyle"], TextColor = Config.App == MobileAppEnum.SnookerForVenues ? Color.White : Color.Black, HorizontalOptions = LayoutOptions.Center, IsVisible = false, }; this.buttonSearchWorldwide.Clicked += buttonSearchWorldwide_Clicked; this.panelStatus = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 20, 0, 10), Children = { this.labelStatus, this.buttonSearchWorldwide, } }; stack.Children.Add(this.panelStatus); /// List of people /// this.listOfPeopleControl = new ListOfPeopleControl(); this.listOfPeopleControl.IsDarkBackground = Config.App == MobileAppEnum.SnookerForVenues; if (Config.App == MobileAppEnum.SnookerForVenues) { this.listOfPeopleControl.BackgroundColor = Config.ColorBackground; } listOfPeopleControl.UserClickedOnPerson += (s1, e1) => { if (this.UserClickedOnPerson != null) { this.UserClickedOnPerson(this, e1); } }; stack.Children.Add(new ScrollView() { Padding = new Thickness(0, 0, 0, 0), HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Content = this.listOfPeopleControl, }); }
public ProfileVenueControl() { this.Padding = new Thickness(0); this.BackgroundColor = Config.ColorBackground; this.Spacing = 0; // Metro labelMetro = new BybLabel() { Text = "", Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"], HorizontalOptions = LayoutOptions.Center }; // tables label10ftTables = new BybLabel() { Text = "", FontFamily = Config.FontFamily, FontAttributes = FontAttributes.Bold, FontSize = Config.LargerFontSize, BackgroundColor = Color.Transparent, TextColor = Config.ColorRedBackground, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center }; label12ftTables = new BybLabel() { Text = "", FontFamily = Config.FontFamily, FontAttributes = FontAttributes.Bold, FontSize = Config.LargerFontSize, BackgroundColor = Color.Transparent, TextColor = Config.ColorRedBackground, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center }; // panel: not verified this.panelNotVerifiedYet = new StackLayout() { BackgroundColor = Config.ColorBackground, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0), Children = { new BybLabel { Text = "Not verified by the community yet", TextColor = Config.ColorTextOnBackgroundGrayed } } }; // panel verified this.labelVerifiedBy = new BybLabel() { VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackground }; this.labelVerifiedBy.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => { if (FullVenueData.Venue.LastContributorID > 0) { await App.Navigator.GoToPersonProfile(FullVenueData.Venue.LastContributorID); } }), NumberOfTapsRequired = 1 }); this.labelVerifiedOn = new BybLabel() { VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackground }; this.panelVerified = new StackLayout() { Orientation = StackOrientation.Horizontal, Spacing = 2, HorizontalOptions = LayoutOptions.Center, Children = { new BybLabel { Text = "Verified by ", VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackgroundGrayed }, labelVerifiedBy, new BybLabel { Text = " on ", VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackgroundGrayed }, labelVerifiedOn } }; // panel: Invalid this.panelInvalid = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 10, 0, 0), Children = { new BybLabel { Text = "The venue is closed-down (or invalid entry)", FontAttributes = FontAttributes.Bold, TextColor = Config.ColorTextOnBackground } } }; // map this.map = new Xamarin.Forms.Maps.Map() { HeightRequest = Config.IsTablet ? 200 : 160, HorizontalOptions = LayoutOptions.FillAndExpand, }; // website buttonWebsite = new BybLabel { Text = "", TextColor = Config.ColorTextOnBackground, HorizontalOptions = LayoutOptions.FillAndExpand, }; buttonWebsite.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => { if (FullVenueData.Venue.HasWebsite) { App.Navigator.OpenBrowserApp(FullVenueData.Venue.Website); } }), NumberOfTapsRequired = 1 }); this.panelAbout = new StackLayout() { BackgroundColor = Config.ColorBackground, Orientation = StackOrientation.Vertical, Spacing = 5, Padding = new Thickness(0, 0, 0, 0), Children = { labelMetro, new StackLayout { HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 0, 0, 0), Orientation = StackOrientation.Horizontal, Children = { new BybLabel { Text = "10' tables",VerticalTextAlignment = TextAlignment.Center, Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"] }, label10ftTables, new BybLabel { Text = " 12' tables",VerticalTextAlignment = TextAlignment.Center, Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"] }, label12ftTables, } }, this.panelInvalid, this.panelNotVerifiedYet, this.panelVerified, new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 10, 0, 0), Children = { map } }, new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 0, 0, 0), Children = { new BybLabel { Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"], VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Website: " }, this.buttonWebsite } }, } }; this.Children.Add(panelAbout); /// Large buttons /// buttonPhoneNumber = new BybButton() { Text = "", Style = (Style)App.Current.Resources["BlackButtonStyle"] }; buttonPhoneNumber.Clicked += (s1, e1) => { if (FullVenueData.Venue.HasPhoneNumber) { App.Navigator.OpenPhoneCallApp(FullVenueData.Venue.PhoneNumber); } }; buttonDirections = new BybButton() { Text = "", Style = (Style)App.Current.Resources["BlackButtonStyle"] }; buttonDirections.Clicked += (s1, e1) => { if (FullVenueData.Venue.Location != null) { App.Navigator.OpenMapsApp(FullVenueData.Venue.Location, FullVenueData.Venue.Name, FullVenueData.Venue.Address); } }; this.buttonEdit = new BybButton() { Text = "Edit / verify", Style = (Style)App.Current.Resources["BlackButtonStyle"], }; this.buttonEdit.Clicked += buttonEdit_Clicked; this.panelWithLargeButtons = new Grid() { BackgroundColor = Config.ColorBackground, Padding = new Thickness(0, 10, 0, 10), ColumnSpacing = 0, RowSpacing = 0, RowDefinitions = new RowDefinitionCollection() { new RowDefinition { Height = new GridLength(Config.LargeButtonsHeight, GridUnitType.Absolute) }, }, ColumnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition { Width = new GridLength(10, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(0.8, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(0.8, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(10, GridUnitType.Absolute) }, } }; panelWithLargeButtons.Children.Add(buttonPhoneNumber, 1, 0); panelWithLargeButtons.Children.Add(buttonDirections, 3, 0); panelWithLargeButtons.Children.Add(buttonEdit, 5, 0); this.Children.Add(panelWithLargeButtons); /// Tabs: Breaks / players / games /// this.buttonBreaks = new BybButtonWithNumber("Breaks") { IsNumberVisible = false }; buttonBreaks.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.Breaks; }; this.buttonMatches = new BybButtonWithNumber("Matches") { IsNumberVisible = false }; buttonMatches.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.Matches; }; this.buttonPeople = new BybButtonWithNumber("Players") { IsNumberVisible = false }; buttonPeople.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.People; }; this.buttonGames = new BybButtonWithNumber("Invites") { IsNumberVisible = false }; buttonGames.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.Games; }; Grid gridWithButtons = new Grid() { BackgroundColor = Config.ColorBackgroundWhite, Padding = new Thickness(0, 0, 0, 0), ColumnSpacing = 0, RowSpacing = 0, RowDefinitions = new RowDefinitionCollection() { new RowDefinition { Height = new GridLength(55, GridUnitType.Auto) }, }, ColumnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, } }; gridWithButtons.Children.Add(buttonBreaks, 1, 0); gridWithButtons.Children.Add(buttonMatches, 2, 0); gridWithButtons.Children.Add(buttonPeople, 3, 0); gridWithButtons.Children.Add(buttonGames, 0, 0); this.Children.Add(gridWithButtons); StackLayout panelContent = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Config.ColorGrayBackground, }; // breaks this.listOfBreaksControl = new ListOfSnookerBreaksControl() { HorizontalOptions = LayoutOptions.FillAndExpand, IsVisible = true, Type = ListTypeEnum.Venue, SortType = SnookerBreakSortEnum.ByPoints, }; panelContent.Children.Add(this.listOfBreaksControl); // matches this.listOfMatchesControl = new ListOfSnookerMatchesControl() { HorizontalOptions = LayoutOptions.FillAndExpand, IsVisible = false, }; panelContent.Children.Add(this.listOfMatchesControl); // game hosts this.listOfGameHostsControlFuture = new ListOfGameHostsControl() { HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(5, 5, 5, 5), IsForPast = false, ShowCommentsCount = true, }; this.listOfGameHostsControlPast = new ListOfGameHostsControl() { HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(5, 5, 5, 5), IsForPast = true }; this.buttonNewGameHost = new BybButton() { Style = (Style)App.Current.Resources["SimpleButtonStyle"], HorizontalOptions = LayoutOptions.Start, Text = "Make a New Invite" }; buttonNewGameHost.Clicked += buttonNewGameHost_Clicked; this.panelGameHosts = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, IsVisible = false, Padding = new Thickness(5, 5, 5, 5), Children = { new StackLayout { Padding = new Thickness(5, 0, 0, 0), Children = { buttonNewGameHost, } }, new StackLayout { Padding = new Thickness(5, 10, 0, 0), Children = { new BybLabel { Text = "Active Invites", TextColor = Config.ColorGrayTextOnWhite, HorizontalTextAlignment = TextAlignment.Start, }, } }, //this.panelNoInvitesFuture, this.listOfGameHostsControlFuture, new StackLayout { Padding = new Thickness(5, 10, 0, 0), Children = { new BybLabel { Text = "Past Invites", TextColor = Config.ColorGrayTextOnWhite, HorizontalTextAlignment = TextAlignment.Start, }, } }, this.listOfGameHostsControlPast, } }; panelContent.Children.Add(this.panelGameHosts); // people this.listOfPeopleControl = new ListOfPeopleControl() { IsVisible = false, }; this.listOfPeopleControl.UserClickedOnPerson += async(s, e) => { await App.Navigator.GoToPersonProfile(e.Person.ID); }; panelContent.Children.Add(this.listOfPeopleControl); this.Children.Add(panelContent); this.State = ProfileVenueStateEnum.Games; }