Ejemplo n.º 1
0
        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,
            });
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public FindVenuesControl(bool isMapByDefault = true)
        {
            this.Padding           = new Thickness(0);
            this.RowSpacing        = 0;
            this.ColumnSpacing     = 0;
            this.VerticalOptions   = LayoutOptions.FillAndExpand;
            this.HorizontalOptions = LayoutOptions.FillAndExpand;
            this.BackgroundColor   = Config.ColorGrayBackground;

            /// Map, list
            ///
            this.map = new Xamarin.Forms.Maps.Map()
            {
                HorizontalOptions    = LayoutOptions.FillAndExpand,
                VerticalOptions      = LayoutOptions.FillAndExpand,
                IsShowingUser        = true,
                MinimumHeightRequest = 200,
            };

            this.panelForMap = new Frame()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(0),
                BackgroundColor   = Color.Transparent
            };
            this.panelForMap.Content = this.map;

            this.listOfVenuesControl = new ListOfVenuesControl();
            this.listOfVenuesControl.TextForFailedToLoad = ""; // do not show this error text, because this control will show something
            this.listOfVenuesControl.UserClickedOnVenue += (s1, e1) => {
                if (this.UserClickedOnVenue != null)
                {
                    this.UserClickedOnVenue(this, e1);
                }
            };
            this.layoutForTheList = new ScrollView()
            {
                Padding         = new Thickness(0, 0, 0, 0),
                BackgroundColor = Config.ColorGrayBackground,
                Content         = listOfVenuesControl
            };

            this.buttonMapOrList = new BybButton()
            {
                Text              = "Map",
                Style             = (Style)App.Current.Resources["SimpleButtonStyle"],
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
            };
            this.buttonMapOrList.Clicked += (s1, e1) =>
            {
                this.IsShowingMap = !this.IsShowingMap;
            };

            /// Status
            ///

            this.labelStatus = new BybLabel()
            {
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.Center,
                HeightRequest           = 40,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                TextColor = Config.ColorBlackTextOnWhite,
                //BackgroundColor = Color.Yellow
            };

            this.panelStatus = new StackLayout
            {
                Orientation         = StackOrientation.Vertical,
                Padding             = new Thickness(0, 5, 0, 5),
                Spacing             = 0,
                MinimumWidthRequest = 300,
                HorizontalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor     = Config.ColorGrayBackground,
                IsVisible           = false,
                Children            =
                {
                    labelStatus
                }
            };

            /// Filters
            ///

            // community
            this.communitySelectorControl = new CommunitySelectorControl();
            this.communitySelectorControl.SelectionChanged += communitySelectorControl_SelectionChanged;

            // search
            this.entrySearch = new BybNoBorderEntry()
            {
                Placeholder       = Config.IsAndroid ? "Search" : "Search by name",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };
            this.entrySearch.TextChanged += (s1, e1) => {
                this.buttonClearFilters.IsVisible = string.IsNullOrEmpty(this.entrySearch.Text) == false;
            };
            this.entrySearch.Completed += (s1, e1) =>
            {
                this.needToSearchAgain = true;
            };
            this.buttonClearFilters = new BybButton()
            {
                Text = "x", IsVisible = false, Style = (Style)App.Current.Resources["SimpleButtonStyle"], WidthRequest = 30
            };
            this.buttonClearFilters.Clicked += (s, e) =>
            {
                this.entrySearch.Text = "";
            };

            /// Content
            ///

            this.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            this.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(Config.LargeButtonsHeight * 2 + 10, GridUnitType.Absolute)
            });
            this.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(Config.IsTablet ? 50 : 30, GridUnitType.Absolute)
            });
            this.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            this.Children.Add(new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Spacing     = 0,
                Padding     = new Thickness(0, 0, 0, 0),
                Children    =
                {
                    new StackLayout()
                    {
                        Orientation     = StackOrientation.Horizontal,
                        Padding         = new Thickness(0, 5, 0, 5),
                        HeightRequest   = Config.LargeButtonsHeight,//40,
                        Spacing         = 1,
                        BackgroundColor = Config.ColorGrayBackground,
                        Children        =
                        {
                            communitySelectorControl,
                        }
                    },

                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HeightRequest     = Config.LargeButtonsHeight,//40,
                        Padding           = new Thickness(Config.IsIOS ? 15 : 5, 0, 10, 0),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Spacing           = 1,
                        BackgroundColor   = Config.ColorBackgroundWhite,
                        Children          =
                        {
                            this.entrySearch,
                            this.buttonClearFilters,
                            this.buttonMapOrList,
                        }
                    }
                },
            }, 0, 0);
            this.Children.Add(panelForMap, 0, 1, 1, 3);
            this.Children.Add(layoutForTheList, 0, 1, 1, 3);

            this.Children.Add(panelStatus, 0, 1);

            this.IsShowingMap = isMapByDefault;
        }