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; }
public EventsControl() { this.Padding = new Thickness(0); this.ColumnSpacing = 0; this.RowSpacing = 0; this.BackgroundColor = Config.ColorGrayBackground; this.VerticalOptions = LayoutOptions.FillAndExpand; this.HorizontalOptions = LayoutOptions.FillAndExpand; this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); // tabs buttonNewEvents = new BybButtonWithNumber("Current") { IsNumberVisible = false, HeightRequest = Config.OkCancelButtonsHeight + (Config.IsTablet ? 15 : 5) }; buttonNewEvents.Clicked += (s, e) => { this.IsShowingPastEvents = false; }; buttonPastEvents = new BybButtonWithNumber("Past") { IsNumberVisible = false, HeightRequest = Config.OkCancelButtonsHeight + (Config.IsTablet ? 15 : 5) }; buttonPastEvents.Clicked += (s, e) => { this.IsShowingPastEvents = true; }; this.Children.Add(new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.White, Padding = new Thickness(0, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { buttonNewEvents, buttonPastEvents, } }, 0, 0); // buttons Button buttonAdd = new BybButton() { Text = "New event", Style = (Style)App.Current.Resources["LargeButtonStyle"], HorizontalOptions = LayoutOptions.FillAndExpand }; buttonAdd.Clicked += (s1, e1) => { if (App.Navigator.GetOpenedPage(typeof(NewGameHostPage)) != null) { return; } NewGameHostPage dlg = new NewGameHostPage(); App.Navigator.NavPage.Navigation.PushModalAsync(dlg); dlg.Disappearing += (s2, e2) => { this.ReloadAsync(false); }; }; Button buttonSync = new BybButton() { Text = "Sync", Style = (Style)App.Current.Resources["BlackButtonStyle"], HorizontalOptions = LayoutOptions.FillAndExpand }; buttonSync.Clicked += (s1, e1) => { App.Navigator.StartSyncAndCheckForNotifications(); this.ReloadAsync(false); }; this.panelWithButtons = new StackLayout { Spacing = 1, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, Padding = new Thickness(10, 10, 10, 0), Children = { buttonAdd, buttonSync } }; this.Children.Add(this.panelWithButtons, 0, 1); StackLayout stackLayout = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = new Thickness(), }; // status // this.labelStatus = new BybLabel() // { // HorizontalOptions = LayoutOptions.Center, // TextColor = Config.ColorBlackTextOnWhite, // }; // this.panelStatus = new StackLayout() // { // Orientation = StackOrientation.Vertical, // HorizontalOptions = LayoutOptions.FillAndExpand, // VerticalOptions = LayoutOptions.Start, // Padding = new Thickness(10, 15, 0, 15), // Children = // { // labelStatus // } // }; // stackLayout.Children.Add(this.panelStatus); // current invites this.panelFuture = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = new Thickness(0), Spacing = 0, }; stackLayout.Children.Add(panelFuture); this.listOfGameHostsFuture = new ListOfGameHostsControl(); this.listOfGameHostsFuture.TreatAsASingleItem = true; this.listOfGameHostsFuture.ShowCommentsCount = true; this.listOfGameHostsFuture.Padding = new Thickness(10, 10, 10, 0); this.listOfGameHostsFuture.UserChangedSomething += (s1, e1) => { this.ReloadAsync(false); }; this.panelFuture.Children.Add( new StackLayout() { Orientation = StackOrientation.Vertical, Padding = new Thickness(10, 10, 0, 0), Children = { new BybLabel() { Text = "Your events and events you were invited to:", HorizontalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Start, TextColor = Config.ColorGrayTextOnWhite, } } }); panelFuture.Children.Add(this.listOfGameHostsFuture); var panel = new StackLayout() { Orientation = StackOrientation.Horizontal, Padding = new Thickness(10, 10, 0, 10), Children = { new BybLabel() { Text = "To see public events, go to the", HorizontalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Start, TextColor = Config.ColorGrayTextOnWhite, }, new BybLabel() { Text = "Community page", FontAttributes = FontAttributes.Bold, TextColor = Config.ColorBlackTextOnWhite, } } }; panelFuture.Children.Add(panel); panel.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(async() => { await App.Navigator.GoToCommunity(); }) }); // past invites this.panelPast = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = new Thickness(0), Spacing = 0, }; stackLayout.Children.Add(panelPast); this.listOfGameHostsPast = new ListOfGameHostsControl(); this.listOfGameHostsPast.TreatAsASingleItem = true; this.listOfGameHostsPast.ShowCommentsCount = true; this.listOfGameHostsPast.Padding = new Thickness(10, 10, 10, 0); this.listOfGameHostsPast.IsForPast = true; this.listOfGameHostsPast.UserChangedSomething += (s1, e1) => { this.ReloadAsync(false); }; this.panelPast.Children.Add(this.listOfGameHostsPast); // scrolling and pulltorefresh var scrollView = new ScrollView { Padding = new Thickness(0), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Content = stackLayout, }; this.pullToRefresh = new Refractored.XamForms.PullToRefresh.PullToRefreshLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Content = scrollView, RefreshColor = Config.ColorRedBackground, }; pullToRefresh.RefreshCommand = new Command(() => { this.ReloadAsync(false); }); this.Children.Add(pullToRefresh, 0, 2); this.IsShowingPastEvents = false; }
public GameHostPage(bool isExpectedToAcceptInvitation, bool isModal = true) { this.isExpectedToAcceptInvitation = isExpectedToAcceptInvitation; this.isModal = isModal; this.isAccepted = false; this.BackgroundColor = Config.ColorGrayBackground; this.Padding = new Thickness(0); this.myAthlete = App.Repository.GetMyAthlete(); // ok Button buttonClose = new BybButton { Text = "OK", Style = (Style)App.Current.Resources["BlackButtonStyle"] }; buttonClose.Clicked += buttonOk_Clicked; // delete this.buttonDelete = new BybButton { Text = "Delete", Style = (Style)App.Current.Resources ["LargeButtonStyle"], WidthRequest = Config.IsTablet ? 140 : 100, HorizontalOptions = LayoutOptions.Start, IsVisible = false, }; buttonDelete.Clicked += buttonDelete_Clicked; // add a person this.buttonAddPerson = new BybButton { Text = "Add a player", Style = (Style)App.Current.Resources["LargeButtonStyle"], WidthRequest = Config.IsTablet ? 160 : 120, HorizontalOptions = LayoutOptions.Start, IsVisible = false, }; buttonAddPerson.Clicked += buttonAddPerson_Clicked; this.gameHostsControl = new ListOfGameHostsControl() { ShowCommentsCount = false, IgnoreSingleItemTaps = true, }; this.gameHostsControl.UserChangedSomething += async(s1, e1) => { this.AnythingChanged = true; if (isModal) { await App.Navigator.NavPage.Navigation.PopModalAsync(); } else { await App.Navigator.NavPage.PopAsync(); } }; this.listOfCommentsControl = new ListOfCommentsControl(); this.editor = new BybEditor() { HeightRequest = 40, }; this.editor.Completed += editor_Completed; this.editor.Unfocused += editor_Unfocused; this.editor.Focused += editor_Focused; this.buttonPostComment = new BybButton { Text = "Done", Style = (Style)App.Current.Resources["SimpleButtonStyle"], IsVisible = false, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center }; this.buttonPostComment.Clicked += (s1, e1) => { this.editor.Unfocus(); }; var rootPanel = new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 0, Padding = new Thickness(0, 0, 0, 0), Children = { //new BoxView() { HeightRequest = 20, VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.Transparent }, new ScrollView { Orientation = ScrollOrientation.Vertical, Padding = new Thickness(0, 0, 0, 0), Content = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(10, 10, 10, 0), Children = { gameHostsControl, //panel, listOfCommentsControl, new StackLayout { BackgroundColor = Config.ColorGrayBackground, Padding = new Thickness(10, 10, 0, 0), Children = { new BybLabel { Text = "Enter your comments here:", TextColor = Config.ColorGrayTextOnWhite, }, buttonPostComment } }, new Frame { BackgroundColor = Config.ColorGrayBackground, Padding = new Thickness(10, 5, 5, 5), Content = editor, } } }, }, new BoxView() { HeightRequest = 1, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Transparent }, new StackLayout() { Orientation = StackOrientation.Horizontal, //BackgroundColor = Config.ColorBackground, HorizontalOptions = LayoutOptions.Fill, HeightRequest = Config.OkCancelButtonsHeight, Padding = new Thickness(Config.OkCancelButtonsPadding), Spacing = 1, Children = { buttonDelete, buttonAddPerson, buttonClose, } } } }; this.title = null; if (isModal) { this.title = new BybTitle("Byb Invite"); rootPanel.Children.Insert(0, title); } this.Content = rootPanel; }