public PickAthletePage() { this.BackgroundColor = Config.ColorGrayBackground; bool friendsByDefault = App.Cache.People.GetFriends().Count() > 0; // FindPeopleControl this.findPeopleControl = new FindPeopleControl(friendsByDefault) { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 0, 0, 0) }; this.findPeopleControl.UserClickedOnPerson += (s1, e1) => { if (this.UserMadeSelection != null) { this.UserMadeSelection(this, new SelectedPersonEventArgs() { Person = e1.Person }); } }; // buttons Button buttonCancel = new BybButton { Text = "Cancel", Style = (Style)App.Current.Resources["LargeButtonStyle"] }; buttonCancel.Clicked += (s1, e1) => { if (this.UserMadeSelection != null) { this.UserMadeSelection(this, new SelectedPersonEventArgs() { Person = null }); } }; buttonUnknown = new BybButton { Text = "Unknown", Style = (Style)App.Current.Resources["BlackButtonStyle"] }; buttonUnknown.Clicked += (s1, e1) => { if (this.UserMadeSelection != null) { this.UserMadeSelection(this, new SelectedPersonEventArgs() { Person = null, IsUnknown = true, }); } }; var panelOkCancel = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, HeightRequest = Config.OkCancelButtonsHeight, Padding = new Thickness(Config.OkCancelButtonsPadding), Spacing = 1, Children = { buttonCancel, buttonUnknown, } }; this.title = new BybTitle("Pick Opponent") { VerticalOptions = LayoutOptions.Start }; // content Content = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 0, Children = { title, findPeopleControl, panelOkCancel } }; Padding = new Thickness(0, 0, 0, 0); }
public PickCommunityPage() { this.myAthlete = App.Repository.GetMyAthlete(); this.myCountry = Country.Get(myAthlete.Country); // title this.title = new BybTitle("") { BackgroundColor = Config.ColorBlackBackground }; this.NameAsCommunity = true; // ok, cancel Button buttonCancel = new BybButton() { Style = (Style)App.Current.Resources["LargeButtonStyle"], Text = "Cancel" }; buttonCancel.Clicked += buttonCancel_Clicked; // stacks this.stackTop = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Config.ColorBackground, Spacing = 1, }; this.stackCountries = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Config.ColorBackground, Spacing = 1, }; this.stackMetros = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Config.ColorBackground, Spacing = 1, }; // content Grid grid = new Grid() { RowDefinitions = { new RowDefinition() { Height = new GridLength(Config.TitleHeight, GridUnitType.Absolute) }, new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition() { Height = new GridLength(Config.OkCancelButtonsHeight + Config.OkCancelButtonsPadding + Config.OkCancelButtonsPadding, GridUnitType.Absolute) }, }, }; grid.Children.Add(title, 0, 0); grid.Children.Add(new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, BackgroundColor = Color.Transparent, Padding = new Thickness(Config.OkCancelButtonsPadding), Spacing = 1, Children = { buttonCancel, //buttonOk, } }, 0, 2); grid.Children.Add(new ScrollView() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Padding = new Thickness(0), Content = new StackLayout() { Orientation = StackOrientation.Vertical, Spacing = 0, Padding = new Thickness(0), Children = { this.stackTop, this.createDivider("Countries"), this.stackCountries, this.createDivider("Cities"), this.stackMetros, } } }, 0, 1); this.BackgroundColor = Config.ColorBlackBackground; this.Padding = new Thickness(0, 0, 0, 0); this.Content = grid; }
public PickOwnerOfABreakPage(SnookerMatchMetadata metadata) { this.metadata = metadata; this.title = new BybTitle("Whose Break Is It?") { VerticalOptions = LayoutOptions.Start }; double imageSize = Config.DeviceScreenHeightInInches < 4 ? 70 : 100; // images this.imageYou = new Image() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Source = App.ImagesService.GetImageSource(null) }; this.imageOpponent = new Image() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Source = App.ImagesService.GetImageSource(null) }; this.labelYou = new BybLabel() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Text = "You" }; this.labelOpponent = new BybLabel() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, }; Grid gridWithImages = new Grid() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, Padding = new Thickness(0), ColumnSpacing = 0, RowSpacing = 0, BackgroundColor = Color.White, }; gridWithImages.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridWithImages.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Absolute) }); gridWithImages.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); gridWithImages.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(10, GridUnitType.Absolute) }); gridWithImages.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(imageSize, GridUnitType.Absolute) }); gridWithImages.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40, GridUnitType.Absolute) }); gridWithImages.Children.Add(this.imageYou, 0, 1); gridWithImages.Children.Add(this.imageOpponent, 2, 1); gridWithImages.Children.Add(this.labelYou, 0, 2); gridWithImages.Children.Add(this.labelOpponent, 2, 2); this.imageYou.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => { youClicked(); }), NumberOfTapsRequired = 1 }); this.labelYou.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => { youClicked(); }), NumberOfTapsRequired = 1 }); this.imageOpponent.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => { opponentClicked(); }), NumberOfTapsRequired = 1 }); this.labelOpponent.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => { opponentClicked(); }), NumberOfTapsRequired = 1 }); // cancel button Button buttonCancel = new BybButton { Style = (Style)App.Current.Resources["LargeButtonStyle"], Text = "Cancel" }; buttonCancel.Clicked += (s1, e1) => { if (this.UserMadeSelection != null) { this.UserMadeSelection(this, null); } }; var panelOkCancel = new StackLayout() { Orientation = StackOrientation.Horizontal, //BackgroundColor = Config.ColorBackground, HorizontalOptions = LayoutOptions.Fill, HeightRequest = Config.OkCancelButtonsHeight, Padding = new Thickness(Config.OkCancelButtonsPadding), Spacing = 1, Children = { buttonCancel } }; // content Content = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, Children = { new ScrollView { Padding = new Thickness(0), VerticalOptions = LayoutOptions.FillAndExpand, Content = new StackLayout { Padding = new Thickness(0), Spacing = 0, Orientation = StackOrientation.Vertical, Children = { title, gridWithImages } } }, panelOkCancel } }; Padding = new Thickness(0, 0, 0, 0); this.labelYou.Text = metadata.PrimaryAthleteName; this.imageYou.Source = App.ImagesService.GetImageSource(metadata.PrimaryAthletePicture); if (this.metadata.HasOpponentAthlete == false) { this.imageOpponent.Source = new FileImageSource() { File = "plus.png" }; this.labelOpponent.Text = "Pick"; } else { this.imageOpponent.Source = App.ImagesService.GetImageSource(this.metadata.OpponentPicture); this.labelOpponent.Text = this.metadata.OpponentAthleteName; } }
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; }