public NewsfeedItemPage(NewsfeedItemWebModel item, bool isModal) { this.isModal = isModal; this.item = item; NewsfeedItemBaseControl newsfeedItemControl; if (item.ItemType == NewsfeedItemTypeEnum.Post) { newsfeedItemControl = new NewsfeedItemPostControl(item, false); } else if (item.ItemType == NewsfeedItemTypeEnum.Result) { newsfeedItemControl = new NewsfeedItemResultControl(item, false); } else if (item.ItemType == NewsfeedItemTypeEnum.Score) { newsfeedItemControl = new NewsfeedItemScoreControl(item, false); } else if (item.ItemType == NewsfeedItemTypeEnum.GameHost) { newsfeedItemControl = new NewsfeedItemGameHostControl(item, false); } else if (item.ItemType == NewsfeedItemTypeEnum.NewUser) { newsfeedItemControl = new NewsfeedItemNewUserControl(item, true); } else { throw new NotImplementedException(); } newsfeedItemControl.ShowCommentsCount = false; newsfeedItemControl.TreatAsASingleItem = false; newsfeedItemControl.NeedsARefresh += (s1, e1) => { this.AnythingChanged = true; }; //newsfeedItemControl.Padding = new Thickness(0); this.labelLoading = new BybLabel() { HeightRequest = 40, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Config.ColorBlackTextOnWhite, IsVisible = true, Text = "Loading...", }; this.listOfCommentsControl = new ListOfCommentsControl() { Padding = new Thickness(10, 10, 0, 0), }; this.editor = new BybEditor() { HeightRequest = 40, }; this.editor.Unfocused += editor_Unfocused; this.editor.Focused += editor_Focused; this.editor.Completed += editor_Completed; this.buttonCancel = new BybButton { Text = "Close", Style = (Style)App.Current.Resources["BlackButtonStyle"] }; buttonCancel.Clicked += buttonCancel_Clicked; Button buttonPostComment = new BybButton { Text = "Done", Style = (Style)App.Current.Resources["SimpleButtonStyle"], HorizontalOptions = LayoutOptions.End }; buttonPostComment.Clicked += buttonPostComment_Clicked; this.panelWithButtons = new StackLayout() { Orientation = StackOrientation.Horizontal, //BackgroundColor = Config.ColorBackground, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = Config.OkCancelButtonsHeight, Padding = new Thickness(10, 0, 10, 0), Spacing = 0, IsVisible = false, Children = { buttonPostComment, //buttonCancel2, } }; var stackLayout = new StackLayout { Spacing = 0, Padding = new Thickness(0, 0, 0, 0), Children = { new StackLayout { Padding = new Thickness(10, 10, 10, 0), Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { newsfeedItemControl, } }, this.labelLoading, new ScrollView { Padding = new Thickness(10, 0, 10, 10), VerticalOptions = LayoutOptions.FillAndExpand, Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { this.listOfCommentsControl, new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Config.ColorGrayBackground, Padding = new Thickness(10, 10, 0, 0), Children = { new BybLabel { Text = "Enter your comments here:", VerticalOptions = LayoutOptions.Center, TextColor = Config.ColorGrayTextOnWhite }, panelWithButtons, }, }, // new Frame // { // BackgroundColor = Config.ColorGrayBackground, // Padding = new Thickness(10,10,0,0), // Content = new BybLabel // { // Text = "Enter your comments here:" // } // }, //panelWithButtons, new Frame { BackgroundColor = Config.ColorGrayBackground, Padding = new Thickness(15, 5, 5, 5), Content = editor, }, } } }, new StackLayout() { Orientation = StackOrientation.Horizontal, //BackgroundColor = Config.ColorBackground, HorizontalOptions = LayoutOptions.Fill, HeightRequest = Config.OkCancelButtonsHeight, Padding = new Thickness(Config.OkCancelButtonsPadding), Children = { buttonCancel, } } } }; if (this.isModal) { stackLayout.Children.Insert(0, new BybTitle("Comments")); } this.Content = stackLayout; this.Padding = new Thickness(0, 0, 0, 0); this.BackgroundColor = Config.ColorGrayBackground; this.Title = "Comments"; }
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; }