Esempio n. 1
0
        public async Task GoToMyProfile(ProfilePersonStateEnum state, bool forceReload)
        {
            if (rootPage == null)
            {
                return;
            }

            await NavPage.PopToRootAsync();

            rootPage.InitAsMyProfile(state, forceReload);

            this.UpdateNavigationMenuButtons(true);
        }
Esempio n. 2
0
        public async Task GoToPersonProfile(int athleteID, ProfilePersonStateEnum state = ProfilePersonStateEnum.Unknown)
        {
            var openedPage = this.GetOpenedPage(typeof(MainSnookerPage)) as MainSnookerPage;

            if (openedPage != null && openedPage.State == MainSnookerPage.StateEnum.Person && openedPage.AthleteID == athleteID)
            {
                return;
            }

            var newPage = new MainSnookerPage();

            newPage.InitAsPersonProfile(athleteID, state);
            await NavPage.PushAsync(newPage);

            this.UpdateNavigationMenuButtons(true);
        }
Esempio n. 3
0
        public void InitAsMyProfile(ProfilePersonStateEnum state, bool forceReload = false)
        {
            TraceHelper.TraceInfoForResponsiveness("InitAsMyProfile Begin +++++++++++");

            Athlete athlete = App.Repository.GetMyAthlete();

            if (this.profilePersonControl == null)
            {
                this.profilePersonControl                = new ProfilePersonControl();
                this.profilePersonControl.LoadStarted   += () => { this.Title = "... loading ..."; };
                this.profilePersonControl.LoadCompleted += (ok) => { this.UpdateTheTitle(); };
                this.rootForProfilePerson                = new ScrollView()
                {
                    Padding = new Thickness(0),
                    Content = this.profilePersonControl
                };
                grid.Children.Add(rootForProfilePerson);
            }
            if (state != ProfilePersonStateEnum.Unknown)
            {
                this.profilePersonControl.State = state;
            }

            this.profilePersonControl.FillAsync(athlete, !forceReload);
            this.rootForProfilePerson.IsVisible = true;

            if (this.rootForRecord != null)
            {
                this.rootForRecord.IsVisible = false;
            }
            if (this.rootForProfileVenue != null)
            {
                this.rootForProfileVenue.IsVisible = false;
            }
            if (this.rootForCommunity != null)
            {
                this.rootForCommunity.IsVisible = false;
            }
            if (this.rootForEvents != null)
            {
                this.rootForEvents.IsVisible = false;
            }

            this.updateButtons();

            TraceHelper.TraceInfoForResponsiveness("InitAsMyProfile End +++++++++++");
        }
Esempio n. 4
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;
        }