private void buttonNewGameHost_Clicked(object sender, EventArgs e) { if (App.Navigator.GetOpenedPage(typeof(NewGameHostPage)) != null) { return; } NewGameHostPage dlg = new NewGameHostPage(); dlg.SetVenue(this.FullVenueData.Venue); App.Navigator.NavPage.Navigation.PushModalAsync(dlg); dlg.Disappearing += (s2, e2) => { //var timer = new System.Timers.Timer(1000); //timer.Start(); //timer.Elapsed += (s3, e1) => //{ // timer.Stop(); // Device.BeginInvokeOnMainThread(async () => // { // await App.Navigator.NavPage.Navigation.PopAsync(); // App.Navigator.GoToPersonProfile(this.FullVenueData.VenueID); // //App.Navigator.NavPage.PopAsync(); // //App.Navigator.RootPage.InitAsVenueProfile(this.FullVenueData.VenueID); // }); //}; }; }
async void buttonInvite_Clicked(object sender, EventArgs e) { if (App.Navigator.GetOpenedPage(typeof(NewGameHostPage)) != null) { return; } if (this.fullPlayerData == null || this.fullPlayerData.Person == null) { return; } NewGameHostPage page = new NewGameHostPage(); page.AddPerson(this.fullPlayerData.Person); await App.Navigator.NavPage.Navigation.PushModalAsync(page); }
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 NewsfeedControl() { this.Spacing = 0; this.BackgroundColor = Config.ColorGrayBackground; this.Padding = new Thickness(0); /// community selector /// this.communitySelectorControl = new CommunitySelectorControl(); this.communitySelectorControl.SelectionChanged += communitySelectorControl_SelectionChanged; this.Children.Add(new StackLayout() { Padding = new Thickness(0, 5, 0, 10), HeightRequest = Config.LargeButtonsHeight,// 40, Spacing = 1, Orientation = StackOrientation.Horizontal, BackgroundColor = Config.ColorGrayBackground, Children = { communitySelectorControl, } }); /// buttons /// Button buttonPost = new BybButton() { Text = "Post", Style = (Style)App.Current.Resources["BlackButtonStyle"], HorizontalOptions = LayoutOptions.FillAndExpand }; Button buttonGameHost = new BybButton() { Text = "New event", Style = (Style)App.Current.Resources["BlackButtonStyle"], HorizontalOptions = LayoutOptions.FillAndExpand }; buttonPost.Clicked += (s1, e1) => { if (this.CurrentCommunity == null || this.CurrentCommunity.Country == null) { App.Navigator.DisplayAlertRegular("You don't have enough contributions to post on the Planet Earth level. Select a smaller community to post."); return; } if (App.Navigator.GetOpenedPage(typeof(NewPostPage)) != null) { return; } NewPostPage dlg = new NewPostPage(this.CurrentCommunity.Country, this.CurrentCommunity.MetroID); App.Navigator.NavPage.Navigation.PushModalAsync(dlg); dlg.Disappearing += (s2, e2) => { this.reloadAsync(!dlg.Posted); }; }; buttonGameHost.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(!dlg.GameHostCreated); }; }; this.Children.Add(new StackLayout() { Spacing = 1, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 0, 10, 0), Children = { buttonGameHost, buttonPost, } }); this.list = new ListOfNewsfeedItemsControl(); this.list.NeedsARefresh += () => { this.reloadAsync(false); }; this.Children.Add(list); }