Esempio n. 1
0
        private void buttonSettings_Clicked(object sender, EventArgs e)
        {
            FVOConfigPage page = new FVOConfigPage();

            this.Navigation.PushModalAsync(page);

            page.Disappearing += (s1, e1) =>
            {
                if (page.ChangesMade)
                {
                    var me = App.Repository.GetMyAthlete();
                    this.findPeopleControl.ReloadAsync(CommunitySelection.CreateDefault(me), false);
                }
            };
        }
        public CommunitySelectorControl()
        {
            this.Selection = CommunitySelection.CreateDefault(App.Repository.GetMyAthlete());

            this.Orientation       = StackOrientation.Horizontal;
            this.BackgroundColor   = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorBackground : Config.ColorBackgroundWhite;
            this.HeightRequest     = Config.LargeButtonsHeight;// 40;
            this.Padding           = new Thickness(15, 0, 10, 0);
            this.Spacing           = 5;
            this.HorizontalOptions = LayoutOptions.FillAndExpand;
            this.VerticalOptions   = LayoutOptions.Start;

            this.labelLabel = new BybLabel()
            {
                TextColor       = Config.App == MobileAppEnum.SnookerForVenues ? Config.ColorTextOnBackgroundGrayed : Config.ColorGrayTextOnWhite,
                VerticalOptions = LayoutOptions.Center,
            };
            this.NameAsCommunity = true;
            this.Children.Add(this.labelLabel);
            this.labelCommunityName = new BybLabel()
            {
                Text              = Selection.ToString(),
                FontFamily        = Config.FontFamily,
                FontAttributes    = FontAttributes.Bold,
                TextColor         = Config.App == MobileAppEnum.SnookerForVenues ? Color.White : Color.Black,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            this.Children.Add(this.labelCommunityName);
            this.labelAskToTap = new BybLabel()
            {
                IsVisible       = false,
                Text            = "(tap here)",
                FontFamily      = Config.FontFamily,
                TextColor       = Color.Red,
                VerticalOptions = LayoutOptions.Center,
            };
            this.Children.Add(this.labelAskToTap);

            Image image = new Image()
            {
                VerticalOptions = LayoutOptions.Center,
                WidthRequest    = Config.RedArrowImageSize,
                HeightRequest   = Config.RedArrowImageSize,
                Source          = new FileImageSource()
                {
                    File = "arrowRight.png"
                }
            };

            this.Children.Add(image);

            this.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(async() =>
                {
                    if (App.Navigator.GetOpenedModalPage(typeof(PickCommunityPage)) != null)
                    {
                        return;
                    }

                    PickCommunityPage page     = new PickCommunityPage();
                    page.AllowFriendsSelection = AllowFriendsSelection;
                    page.DoNotCheckSelection   = this.IsAskToTapVisible;
                    await App.Navigator.NavPage.Navigation.PushModalAsync(page);
                    page.SelectionChanged += (s1, e1) =>
                    {
                        this.Selection = page.Selection;
                        if (this.SelectionChanged != null)
                        {
                            this.SelectionChanged(this, EventArgs.Empty);
                        }
                    };
                    await page.Initialize(this.Selection);
                })
            });
        }