Ejemplo n.º 1
0
        public ProfileVenueControl()
        {
            this.Padding         = new Thickness(0);
            this.BackgroundColor = Config.ColorBackground;
            this.Spacing         = 0;

            // Metro
            labelMetro = new BybLabel()
            {
                Text = "", Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"], HorizontalOptions = LayoutOptions.Center
            };

            // tables
            label10ftTables = new BybLabel()
            {
                Text                  = "",
                FontFamily            = Config.FontFamily,
                FontAttributes        = FontAttributes.Bold,
                FontSize              = Config.LargerFontSize,
                BackgroundColor       = Color.Transparent,
                TextColor             = Config.ColorRedBackground,
                VerticalOptions       = LayoutOptions.Center,
                VerticalTextAlignment = TextAlignment.Center
            };
            label12ftTables = new BybLabel()
            {
                Text                  = "",
                FontFamily            = Config.FontFamily,
                FontAttributes        = FontAttributes.Bold,
                FontSize              = Config.LargerFontSize,
                BackgroundColor       = Color.Transparent,
                TextColor             = Config.ColorRedBackground,
                VerticalOptions       = LayoutOptions.Center,
                VerticalTextAlignment = TextAlignment.Center
            };

            // panel: not verified
            this.panelNotVerifiedYet = new StackLayout()
            {
                BackgroundColor = Config.ColorBackground,
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0),
                Children        =
                {
                    new BybLabel {
                        Text = "Not verified by the community yet", TextColor = Config.ColorTextOnBackgroundGrayed
                    }
                }
            };

            // panel verified
            this.labelVerifiedBy = new BybLabel()
            {
                VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackground
            };
            this.labelVerifiedBy.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(async() =>
                {
                    if (FullVenueData.Venue.LastContributorID > 0)
                    {
                        await App.Navigator.GoToPersonProfile(FullVenueData.Venue.LastContributorID);
                    }
                }),
                NumberOfTapsRequired = 1
            });
            this.labelVerifiedOn = new BybLabel()
            {
                VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackground
            };
            this.panelVerified = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                Spacing           = 2,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new BybLabel {
                        Text = "Verified by ", VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackgroundGrayed
                    },
                    labelVerifiedBy,
                    new BybLabel {
                        Text = " on ", VerticalTextAlignment = TextAlignment.Center, TextColor = Config.ColorTextOnBackgroundGrayed
                    },
                    labelVerifiedOn
                }
            };

            // panel: Invalid
            this.panelInvalid = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = new Thickness(0, 10, 0, 0),
                Children          =
                {
                    new BybLabel {
                        Text = "The venue is closed-down (or invalid entry)", FontAttributes = FontAttributes.Bold, TextColor = Config.ColorTextOnBackground
                    }
                }
            };

            // map
            this.map = new Xamarin.Forms.Maps.Map()
            {
                HeightRequest     = Config.IsTablet ? 200 : 160,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            // website
            buttonWebsite = new BybLabel
            {
                Text              = "",
                TextColor         = Config.ColorTextOnBackground,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            buttonWebsite.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    if (FullVenueData.Venue.HasWebsite)
                    {
                        App.Navigator.OpenBrowserApp(FullVenueData.Venue.Website);
                    }
                }),
                NumberOfTapsRequired = 1
            });

            this.panelAbout = new StackLayout()
            {
                BackgroundColor = Config.ColorBackground,
                Orientation     = StackOrientation.Vertical,
                Spacing         = 5,
                Padding         = new Thickness(0, 0, 0, 0),
                Children        =
                {
                    labelMetro,

                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        Padding           = new Thickness(0,               0, 0, 0),
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            new BybLabel {
                                Text = "10' tables",VerticalTextAlignment = TextAlignment.Center, Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"]
                            },
                            label10ftTables,
                            new BybLabel {
                                Text = " 12' tables",VerticalTextAlignment = TextAlignment.Center, Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"]
                            },
                            label12ftTables,
                        }
                    },

                    this.panelInvalid,
                    this.panelNotVerifiedYet,
                    this.panelVerified,

                    new StackLayout
                    {
                        Orientation       = StackOrientation.Vertical,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Padding           = new Thickness(0,              10, 0, 0),
                        Children          =
                        {
                            map
                        }
                    },

                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        Padding           = new Thickness(0,               0, 0, 0),
                        Children          =
                        {
                            new BybLabel
                            {
                                Style = (Style)App.Current.Resources["LabelOnBackgroundStyle"],
                                VerticalTextAlignment = TextAlignment.Center,
                                HorizontalOptions     = LayoutOptions.FillAndExpand,
                                Text = "Website: "
                            },
                            this.buttonWebsite
                        }
                    },
                }
            };
            this.Children.Add(panelAbout);

            /// Large buttons
            ///

            buttonPhoneNumber = new BybButton()
            {
                Text = "", Style = (Style)App.Current.Resources["BlackButtonStyle"]
            };
            buttonPhoneNumber.Clicked += (s1, e1) =>
            {
                if (FullVenueData.Venue.HasPhoneNumber)
                {
                    App.Navigator.OpenPhoneCallApp(FullVenueData.Venue.PhoneNumber);
                }
            };

            buttonDirections = new BybButton()
            {
                Text = "", Style = (Style)App.Current.Resources["BlackButtonStyle"]
            };
            buttonDirections.Clicked += (s1, e1) =>
            {
                if (FullVenueData.Venue.Location != null)
                {
                    App.Navigator.OpenMapsApp(FullVenueData.Venue.Location, FullVenueData.Venue.Name, FullVenueData.Venue.Address);
                }
            };

            this.buttonEdit = new BybButton()
            {
                Text  = "Edit / verify",
                Style = (Style)App.Current.Resources["BlackButtonStyle"],
            };
            this.buttonEdit.Clicked += buttonEdit_Clicked;

            this.panelWithLargeButtons = new Grid()
            {
                BackgroundColor = Config.ColorBackground,
                Padding         = new Thickness(0, 10, 0, 10),
                ColumnSpacing   = 0,
                RowSpacing      = 0,
                RowDefinitions  = new RowDefinitionCollection()
                {
                    new RowDefinition {
                        Height = new GridLength(Config.LargeButtonsHeight, GridUnitType.Absolute)
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition {
                        Width = new GridLength(10, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.8, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.8, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(10, GridUnitType.Absolute)
                    },
                }
            };
            panelWithLargeButtons.Children.Add(buttonPhoneNumber, 1, 0);
            panelWithLargeButtons.Children.Add(buttonDirections, 3, 0);
            panelWithLargeButtons.Children.Add(buttonEdit, 5, 0);
            this.Children.Add(panelWithLargeButtons);

            /// Tabs: Breaks / players / games
            ///

            this.buttonBreaks = new BybButtonWithNumber("Breaks")
            {
                IsNumberVisible = false
            };
            buttonBreaks.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.Breaks; };
            this.buttonMatches    = new BybButtonWithNumber("Matches")
            {
                IsNumberVisible = false
            };
            buttonMatches.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.Matches; };
            this.buttonPeople      = new BybButtonWithNumber("Players")
            {
                IsNumberVisible = false
            };
            buttonPeople.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.People; };
            this.buttonGames      = new BybButtonWithNumber("Invites")
            {
                IsNumberVisible = false
            };
            buttonGames.Clicked += (s, e) => { this.State = ProfileVenueStateEnum.Games; };

            Grid gridWithButtons = new Grid()
            {
                BackgroundColor = Config.ColorBackgroundWhite,
                Padding         = new Thickness(0, 0, 0, 0),
                ColumnSpacing   = 0,
                RowSpacing      = 0,
                RowDefinitions  = new RowDefinitionCollection()
                {
                    new RowDefinition {
                        Height = new GridLength(55, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            gridWithButtons.Children.Add(buttonBreaks, 1, 0);
            gridWithButtons.Children.Add(buttonMatches, 2, 0);
            gridWithButtons.Children.Add(buttonPeople, 3, 0);
            gridWithButtons.Children.Add(buttonGames, 0, 0);
            this.Children.Add(gridWithButtons);

            StackLayout panelContent = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Config.ColorGrayBackground,
            };

            // breaks
            this.listOfBreaksControl = new ListOfSnookerBreaksControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = true,
                Type     = ListTypeEnum.Venue,
                SortType = SnookerBreakSortEnum.ByPoints,
            };
            panelContent.Children.Add(this.listOfBreaksControl);

            // matches
            this.listOfMatchesControl = new ListOfSnookerMatchesControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false,
            };
            panelContent.Children.Add(this.listOfMatchesControl);

            // game hosts
            this.listOfGameHostsControlFuture = new ListOfGameHostsControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(5, 5, 5, 5),
                IsForPast         = false,
                ShowCommentsCount = true,
            };
            this.listOfGameHostsControlPast = new ListOfGameHostsControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(5, 5, 5, 5),
                IsForPast         = true
            };
            this.buttonNewGameHost = new BybButton()
            {
                Style             = (Style)App.Current.Resources["SimpleButtonStyle"],
                HorizontalOptions = LayoutOptions.Start,
                Text = "Make a New Invite"
            };
            buttonNewGameHost.Clicked += buttonNewGameHost_Clicked;
            this.panelGameHosts        = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false,
                Padding           = new Thickness(5, 5, 5, 5),
                Children          =
                {
                    new StackLayout
                    {
                        Padding  = new Thickness(5, 0, 0, 0),
                        Children =
                        {
                            buttonNewGameHost,
                        }
                    },
                    new StackLayout
                    {
                        Padding  = new Thickness(5, 10, 0, 0),
                        Children =
                        {
                            new BybLabel
                            {
                                Text      = "Active Invites",
                                TextColor = Config.ColorGrayTextOnWhite,
                                HorizontalTextAlignment = TextAlignment.Start,
                            },
                        }
                    },
                    //this.panelNoInvitesFuture,
                    this.listOfGameHostsControlFuture,
                    new StackLayout
                    {
                        Padding  = new Thickness(5, 10, 0, 0),
                        Children =
                        {
                            new BybLabel
                            {
                                Text      = "Past Invites",
                                TextColor = Config.ColorGrayTextOnWhite,
                                HorizontalTextAlignment = TextAlignment.Start,
                            },
                        }
                    },
                    this.listOfGameHostsControlPast,
                }
            };
            panelContent.Children.Add(this.panelGameHosts);

            // people
            this.listOfPeopleControl = new ListOfPeopleControl()
            {
                IsVisible = false,
            };
            this.listOfPeopleControl.UserClickedOnPerson += async(s, e) =>
            {
                await App.Navigator.GoToPersonProfile(e.Person.ID);
            };
            panelContent.Children.Add(this.listOfPeopleControl);
            this.Children.Add(panelContent);

            this.State = ProfileVenueStateEnum.Games;
        }
Ejemplo n.º 2
0
        public ProfilePersonControl()
        {
            this.Padding           = new Thickness(0);
            this.BackgroundColor   = Config.ColorBackground;
            this.ColumnSpacing     = 0;
            this.RowSpacing        = 0;
            this.VerticalOptions   = LayoutOptions.FillAndExpand;
            this.HorizontalOptions = LayoutOptions.FillAndExpand;

            /// info panel
            ///
            this.infoControl = new ProfilePersonInfoControl()
            {
                Padding = new Thickness(0, 0, 0, 15), HorizontalOptions = LayoutOptions.FillAndExpand
            };
            this.infoControl.ClickedOnBestBreak += (s, e) =>
            {
                this.State = ProfilePersonStateEnum.Breaks;
                this.listOfBreaksControl.Sort(SnookerBreakSortEnum.ByPoints);
            };
            this.infoControl.ClickedOnBestFrame += (s, e) =>
            {
                this.State = ProfilePersonStateEnum.Matches;
                this.listOfMatchesControl.Sort(SnookerMatchSortEnum.ByBestFrame);
            };
            this.infoControl.ClickedOnContributions += (s, e) =>
            {
                App.Navigator.DisplayAlertRegular("Verifying snooker venues is an example of a contribution.");
            };
            this.infoControl.ClickedOnAbout += (s, e) =>
            {
                if (IsMyAthlete == true)
                {
                    App.Navigator.OpenProfileEditPage(true, true);
                }
            };

            /// panel "Me"
            ///
            Button buttonEditProfile = new BybButton()
            {
                Text = "Edit profile", Style = (Style)App.Current.Resources["BlackButtonStyle"], FontFamily = Config.FontFamily, TextColor = Config.ColorTextOnBackground
            };

            buttonEditProfile.Clicked += buttonEditProfile_Clicked;
            this.buttonSync            = new BybButton()
            {
                Text = "Sync now", Style = (Style)App.Current.Resources["BlackButtonStyle"], FontFamily = Config.FontFamily, TextColor = Config.ColorTextOnBackground
            };
            this.buttonSync.Clicked += buttonSync_Clicked;
            this.panelMe             = new Grid()
            {
                Padding        = new Thickness(10, 0, 10, 10),
                ColumnSpacing  = Config.SpaceBetweenButtons,
                RowSpacing     = 0,
                RowDefinitions = new RowDefinitionCollection()
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };
            this.panelMe.Children.Add(buttonSync, 0, 0);
            this.panelMe.Children.Add(buttonEditProfile, 1, 0);

            /// panel "Not me"
            ///
            this.panelNotMe = new Grid()
            {
                BackgroundColor = Config.ColorBackground,
                Padding         = new Thickness(0, 0, 0, 10),
                ColumnSpacing   = 0,
                RowSpacing      = 0,
                RowDefinitions  = new RowDefinitionCollection()
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition {
                        Width = new GridLength(10, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(10, GridUnitType.Absolute)
                    },
                }
            };
            this.buttonSendFriendRequest = new BybButton()
            {
                Text = "Friend", Style = (Style)App.Current.Resources["BlackButtonStyle"]
            };
            this.buttonSendFriendRequest.Clicked += buttonSendFriendRequest_Clicked;
            this.buttonInvite = new BybButton()
            {
                Text = "Invite", Style = (Style)App.Current.Resources["BlackButtonStyle"]
            };
            this.buttonInvite.Clicked += buttonInvite_Clicked;
            this.buttonMessage         = new BybButton()
            {
                Text = "Message", Style = (Style)App.Current.Resources["BlackButtonStyle"]
            };
            this.buttonMessage.Clicked += buttonMessage_Clicked;
            this.labelFriendship        = new BybLabel()
            {
                Text = "-", TextColor = Config.ColorTextOnBackgroundGrayed, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center
            };
            this.labelFriendship.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    this.labelFriendship_Tapped();
                }),
                NumberOfTapsRequired = 1
            });
            this.panelNotMe.Children.Add(this.buttonMessage, 1, 0);
            this.panelNotMe.Children.Add(this.buttonInvite, 3, 0);
            this.panelNotMe.Children.Add(this.labelFriendship, 5, 0);
            this.panelNotMe.Children.Add(this.buttonSendFriendRequest, 5, 0);

            /// Tabs: Breaks / matches / opponents
            ///

            this.buttonBreaks = new BybButtonWithNumber("Breaks")
            {
                HeightRequest = 55
            };
            buttonBreaks.Clicked += (s, e) => { this.State = ProfilePersonStateEnum.Breaks; };
            this.buttonMatches    = new BybButtonWithNumber("Matches")
            {
                HeightRequest = 55
            };
            buttonMatches.Clicked += (s, e) => { this.State = ProfilePersonStateEnum.Matches; };
            this.buttonOpponents   = new BybButtonWithNumber("Opponents")
            {
                HeightRequest = 55
            };
            buttonOpponents.Clicked += (s, e) => { this.State = ProfilePersonStateEnum.Opponents; };
            this.buttonVenues        = new BybButtonWithNumber("Venues")
            {
                HeightRequest = 55
            };
            buttonVenues.Clicked += (s, e) => { this.State = ProfilePersonStateEnum.Venues; };

            Grid gridWithButtons = new Grid()
            {
                BackgroundColor = Config.ColorBackgroundWhite,//Config.ColorGrayBackground,
                Padding         = new Thickness(0, 0, 0, 0),
                ColumnSpacing   = 0,
                RowSpacing      = 0,
                RowDefinitions  = new RowDefinitionCollection()
                {
                    new RowDefinition {
                        Height = new GridLength(55, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            gridWithButtons.Children.Add(buttonBreaks, 0, 0);
            gridWithButtons.Children.Add(buttonMatches, 1, 0);
            gridWithButtons.Children.Add(buttonOpponents, 2, 0);
            gridWithButtons.Children.Add(buttonVenues, 3, 0);

            StackLayout panelContent = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Config.ColorGrayBackground,
            };

            // breaks
            this.listOfBreaksControl = new ListOfSnookerBreaksControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = true
            };
            this.listOfBreaksControl.UserWantsToEditRes   += ctrl_UserWantsToEditBreak;
            this.listOfBreaksControl.UserWantsToDeleteRes += ctrl_UserWantsToDeleteBreak;
            panelContent.Children.Add(this.listOfBreaksControl);

            // matches
            this.listOfMatchesControl = new ListOfSnookerMatchesControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };
            this.listOfMatchesControl.UserWantsToDeleteScore += ctrl_UserWantsToDeleteScore;
            this.listOfMatchesControl.UserWantsToEditScore   += ctrl_UserWantsToEditScore;
            this.listOfMatchesControl.UserWantsToViewScore   += ctrl_UserWantsToViewScore;
            panelContent.Children.Add(this.listOfMatchesControl);

            // friends
            this.listOfOpponents = new ListOfOpponentsControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };
            panelContent.Children.Add(this.listOfOpponents);

            // venues
            this.listOfVenues = new ListOfVenuesPlayedControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };
            panelContent.Children.Add(this.listOfVenues);


            /// Grid
            ///
            this.RowDefinitions = new RowDefinitionCollection()
            {
                new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Auto)
                },
                new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Auto)
                },
                new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Auto)
                },
                new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                },
            };
            this.ColumnDefinitions = new ColumnDefinitionCollection()
            {
                new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                }
            };
            this.Children.Add(this.infoControl, 0, 0);
            this.Children.Add(this.panelMe, 0, 1);
            this.Children.Add(this.panelNotMe, 0, 1);
            this.Children.Add(gridWithButtons, 0, 2);
            this.Children.Add(panelContent, 0, 3);

            this.State = ProfilePersonStateEnum.Breaks;
        }
Ejemplo n.º 3
0
        public FVOHistoryPage()
        {
            this.BackgroundColor = Config.ColorBackground;
            this.Padding         = new Thickness(0, 0, 0, 0);

            /// top panel
            ///

            Grid panelTop = new Grid()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = Config.TitleHeight,
                BackgroundColor   = Config.ColorBlackBackground,
                Padding           = new Thickness(20, 0, 20, 0),
            };

            this.labelTop = new BybLabel()
            {
                Text              = "History",
                FontSize          = Config.LargerFontSize,
                TextColor         = Config.ColorTextOnBackground,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };
            panelTop.Children.Add(labelTop);
            var imageBack = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "thinArrow1Left.png"
                },
                HeightRequest     = Config.IsTablet ? 25 : 20,
                WidthRequest      = Config.IsTablet ? 25 : 20,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
            };
            Frame buttonBack = new Frame()
            {
                Padding           = new Thickness(0, 0, 0, 0),
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HasShadow         = false,
                BackgroundColor   = Config.ColorBlackBackground,
                Content           = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal,
                    Spacing     = 10,
                    Children    =
                    {
                        imageBack,
                        new BybLabel()
                        {
                            Text            = "Back",
                            FontSize        = Config.LargerFontSize,
                            TextColor       = Config.ColorTextOnBackground,
                            VerticalOptions = LayoutOptions.Center,
                        }
                    }
                },
            };

            panelTop.Children.Add(buttonBack);
            buttonBack.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    this.Navigation.PopModalAsync();
                }),
                NumberOfTapsRequired = 1
            });
            buttonSync = new BybButton()
            {
                Text              = "Sync",
                Style             = (Style)App.Current.Resources["SimpleButtonStyle"],
                FontSize          = Config.LargerFontSize,
                TextColor         = Config.ColorTextOnBackground,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
            };
            panelTop.Children.Add(buttonSync);
            buttonSync.Clicked += buttonSync_Clicked;

            /// lists
            ///

            this.listOfMatchesControl = new FVOListOfSnookerMatchesControl();
            listOfMatchesControl.HorizontalOptions = LayoutOptions.FillAndExpand;
            listOfMatchesControl.VerticalOptions   = LayoutOptions.FillAndExpand;
            listOfMatchesControl.BackgroundColor   = Config.ColorGrayBackground;
            listOfMatchesControl.Padding           = new Thickness(5);

            this.listOfBreaksControl              = new ListOfSnookerBreaksControl();
            this.listOfBreaksControl.Type         = ListTypeEnum.FVO;
            listOfBreaksControl.HorizontalOptions = LayoutOptions.FillAndExpand;
            listOfBreaksControl.VerticalOptions   = LayoutOptions.FillAndExpand;
            listOfBreaksControl.BackgroundColor   = Config.ColorGrayBackground;
            listOfBreaksControl.Padding           = new Thickness(5);

            Grid grid = new Grid()
            {
                //HorizontalOptions = LayoutOptions.FillAndExpand,
                //VerticalOptions = LayoutOptions.FillAndExpand,
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                },
                RowDefinitions = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                }
            };

            grid.Children.Add(listOfMatchesControl, 0, 0);
            grid.Children.Add(listOfBreaksControl, 1, 0);

            ScrollView scrollView = new ScrollView()
            {
                Padding = new Thickness(0),
                Content = grid,
            };

            /// root panel
            ///

            Grid gridRoot = new Grid()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                },
                RowDefinitions = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = new GridLength(Config.TitleHeight, GridUnitType.Absolute)
                    },
                    new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                }
            };

            gridRoot.Children.Add(panelTop, 0, 0);
            gridRoot.Children.Add(scrollView, 0, 1);
            //grid.Children.Add(panelTop, 0, 2, 0, 1);
            //grid.Children.Add(listOfMatchesControl, 0, 1);
            //grid.Children.Add(listOfBreaksControl, 1, 1);

            this.Content = gridRoot;
        }