Esempio n. 1
0
        public FVOListOfSnookerMatchesControlOld()
        {
            this.BackgroundColor = Config.ColorGrayBackground;
            this.Spacing         = 4;
            this.Padding         = new Thickness(5, 5, 5, 5);

            this.buttonSort = new SimpleButtonWithLittleDownArrow()
            {
                IsVisible = false,
            };
            this.buttonSort.Clicked += buttonSort_Clicked;
            this.panelTop            = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Padding           = new Thickness(5, 0, 5, 0),
                Children          =
                {
                    buttonSort,
                }
            };
            this.Children.Add(this.panelTop);

            this.SortType = SnookerMatchSortEnum.ByDate;
            this.updateSortButton();
        }
Esempio n. 2
0
        public ListOfVenuesPlayedControl()
            : base()
        {
            base.MaxCountToShowByDefault = 5;
            base.MultCountToShow         = 10;

            this.buttonSort = new SimpleButtonWithLittleDownArrow()
            {
                HorizontalOptions = LayoutOptions.End,
            };
            this.buttonSort.Clicked += buttonSort_Clicked;
            this.panelTop.Children.Add(this.buttonSort);

            this.SortType = SnookerVenuesPlayedSortEnum.ByCount;
            this.updateSortButton();
        }
Esempio n. 3
0
        void init()
        {
            /// top panel
            ///

            this.buttonBack = new BybBackButton()
            {
                LabelText = Config.App == MobileAppEnum.SnookerForVenues ? "All frames" : ""
            };
            this.buttonBack.Clicked += (s1, e1) =>
            {
                if (this.UserTappedBack != null)
                {
                    UserTappedBack();
                }
            };
            this.labelTop = new BybLabel()
            {
                Text              = "Frame " + (MatchScore.FrameScores.IndexOf(CurrentFrameScore) + 1).ToString(),
                TextColor         = Color.White,
                FontFamily        = Config.FontFamily,
                FontSize          = Config.LargerFontSize,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };
            this.labelDone = new BybLabel()
            {
                Text                    = "Done",
                TextColor               = Color.White,
                FontFamily              = Config.FontFamily,
                FontSize                = Config.LargerFontSize,
                HorizontalOptions       = LayoutOptions.End,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.End,
                VerticalTextAlignment   = TextAlignment.Center,
            };
            Grid buttonDone = new Grid()
            {
                Padding           = new Thickness(0, 0, Config.IsTablet ? 20 : 10, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                //HasShadow = false,
                BackgroundColor = Config.ColorBlackBackground,
                //Content = this.labelDone,
                Children =
                {
                    this.labelDone
                }
            };

            buttonDone.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    if (this.UserTappedDone != null)
                    {
                        UserTappedDone();
                    }
                })
            });
            this.panelTop = new Grid()
            {
                BackgroundColor   = Config.ColorBlackBackground,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Fill,
                Padding           = new Thickness(0, 20, 0, 0),
                ColumnSpacing     = 0,
                RowSpacing        = 0,
                RowDefinitions    =
                {
                    new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = new GridLength(Config.App == MobileAppEnum.SnookerForVenues ? 200 : 100, GridUnitType.Absolute)
                    },
                    new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition()
                    {
                        Width = new GridLength(Config.App == MobileAppEnum.SnookerForVenues ? 200 : 100, GridUnitType.Absolute)
                    },
                }
            };
            panelTop.Children.Add(buttonBack, 0, 0);
            panelTop.Children.Add(this.labelTop, 1, 0);
            panelTop.Children.Add(buttonDone, 2, 0);
            if (Config.App == MobileAppEnum.SnookerForVenues)
            {
                // add a horizontal line
                panelTop.Children.Add(new BoxView()
                {
                    HeightRequest     = 1,
                    BackgroundColor   = Config.ColorBackground,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.End,
                }, 0, 3, 0, 1);
            }

            /// panel with the frame score, inside secondPanel
            ///
            this.entryCurrentFrameA = new LargeNumberEntry2(Config.ColorBlackBackground)
            {
                BackgroundColor   = Config.ColorBlackBackground,
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(0, Config.IsTablet ? 15 : 5, 0, 0),
                WidthRequest      = Config.App == MobileAppEnum.SnookerForVenues ? 200 : (Config.IsTablet ? 70 : 60),
                TextAlignment     = TextAlignment.End,
            };
            this.entryCurrentFrameB = new LargeNumberEntry2(Config.ColorBlackBackground)
            {
                BackgroundColor   = Config.ColorBlackBackground,
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(0, Config.IsTablet ? 15 : 5, 0, 0),
                WidthRequest      = Config.App == MobileAppEnum.SnookerForVenues ? 200 : (Config.IsTablet ? 70 : 60),
                TextAlignment     = TextAlignment.Start,
            };
            this.labelMatchScore = new BybLabel()
            {
                //Text = "Edit score",
                Text              = "Match score",
                TextColor         = Config.ColorTextOnBackgroundGrayed,
                HorizontalOptions = LayoutOptions.Center,
            };
            this.labelMatchScoreDigits = new BybLabel()
            {
                //Text = "Edit score",
                Text              = (this.MatchScore.MatchScoreA).ToString() + ":" + (this.MatchScore.MatchScoreB).ToString(),
                TextColor         = Config.ColorTextOnBackgroundGrayed,
                HorizontalOptions = LayoutOptions.Center,
            };

            /*
             *          this.labelTapToEditFrameScore = new BybLabel ()
             *          {
             *                  //Text = "Edit score",
             *                  Text = "Frame score",
             *                  TextColor = Config.ColorTextOnBackgroundGrayed,
             *                  HorizontalOptions = LayoutOptions.Center,
             *          };
             */
            this.labelPointsLeft = new BybLabel()
            {
                Text                  = "",
                TextColor             = Config.ColorTextOnBackgroundGrayed,
                HorizontalOptions     = LayoutOptions.Center,
                VerticalTextAlignment = TextAlignment.Center,
            };
            if (Config.IsTablet)
            {
                this.labelPointsLeft.HeightRequest = 40;
            }
            this.entryCurrentFrameA.FocusedOnNumber     += entryCurrentFrameA_FocusedOnNumber;
            this.entryCurrentFrameB.FocusedOnNumber     += entryCurrentFrameB_FocusedOnNumber;
            this.entryCurrentFrameA.UnfocusedFromNumber += entryCurrentFrameA_UnfocusedFromNumber;
            this.entryCurrentFrameB.UnfocusedFromNumber += entryCurrentFrameB_UnfocusedFromNumber;
            this.entryCurrentFrameA.NumberChanged       += entryCurrentFrameA_NumberChanged;
            this.entryCurrentFrameB.NumberChanged       += entryCurrentFrameB_NumberChanged;
            this.panelFrame = new StackLayout()
            {
                IsVisible         = true,
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Spacing           = 0,
                Padding           = new Thickness(0, 0, 0, 0),
                //BackgroundColor = Color.Olive,
                Children =
                {
                    this.labelMatchScore,
                    this.labelMatchScoreDigits,
                    //this.labelTapToEditFrameScore,
                    new StackLayout()
                    {
                        //BackgroundColor = Color.Red,
                        Orientation       = StackOrientation.Horizontal,
                        Spacing           = 0,
                        Padding           = new Thickness(0,      0, 0, 0),
                        HorizontalOptions = LayoutOptions.Center,
                        Children          =
                        {
                            this.entryCurrentFrameA,
                            new BybLabel()
                            {
                                Text                    = ":",
                                FontSize                = Config.App == MobileAppEnum.SnookerForVenues ? 50 : Config.VeryLargeFontSize,
                                TextColor               = Config.ColorTextOnBackgroundGrayed,
                                WidthRequest            = 15,
                                HeightRequest           = Config.App == MobileAppEnum.SnookerForVenues ? 100 : 38,
                                VerticalOptions         = LayoutOptions.End,
                                HorizontalTextAlignment = TextAlignment.Center,
                                VerticalTextAlignment   = TextAlignment.Center,
                            },
                            this.entryCurrentFrameB,
                        }
                    },
                    this.labelPointsLeft,
                }
            };

            /// second panel
            ///
            this.imageYou = new BybPersonImage()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = imageSize,
                HeightRequest     = imageSize,
                BackgroundColor   = Color.Transparent,
                Background        = BackgroundEnum.Black,
            };
            this.imageOpponent = new BybPersonImage()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = imageSize,
                HeightRequest     = imageSize,
                BackgroundColor   = Color.Transparent,
                Background        = BackgroundEnum.Black,
            };
            this.imageYou.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => { this.imageYou_Clicked(); }),
                NumberOfTapsRequired = 1
            });
            this.imageOpponent.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => { this.imageOpponent_Clicked(); }),
                NumberOfTapsRequired = 1
            });
            this.panelSecond = new Grid
            {
                BackgroundColor   = Config.ColorBlackBackground,
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Padding           = new Thickness(15, panelSecondPaddingTop, 15, panelSecondPaddingBottom),
                ColumnSpacing     = 0,
                RowSpacing        = 0,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
            };
            panelSecond.Children.Add(this.imageYou, 0, 0);
            panelSecond.Children.Add(this.panelFrame, 1, 0);
            panelSecond.Children.Add(this.imageOpponent, 2, 0);

            /// a panel for entering frame score
            ///
            this.labelEnteringFrameScore = new BybLabel
            {
                Text                    = "",
                TextColor               = Config.ColorTextOnBackground,
                HeightRequest           = 40,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
            };
            panelEnteringFrameScore = new StackLayout()
            {
                IsVisible         = false,
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(0, 20, 0, 0),
                Spacing           = 5,
                BackgroundColor   = Config.ColorBlackBackground,
                Children          =
                {
                    this.labelEnteringFrameScore,
                    new BybLabel
                    {
                        Text                    = "Tap here when done.",
                        TextColor               = Config.ColorTextOnBackground,
                        HorizontalOptions       = LayoutOptions.Center,
                        HorizontalTextAlignment = TextAlignment.Center,
                        //VerticalTextAlignment = TextAlignment.Center
                    }
                }
            };

            /// the current snooker break
            ///
            this.snookerBreakControl                   = new SnookerBreakControl(new MetadataHelper().FromScoreForYou(this.MatchScore), labelPointsLeft, CurrentFrameScore.ballsOnTable, entryCurrentFrameA, entryCurrentFrameB);
            this.snookerBreakControl.Padding           = new Thickness(0, 0, 0, 0);
            this.snookerBreakControl.VerticalOptions   = LayoutOptions.FillAndExpand;
            this.snookerBreakControl.HorizontalOptions = LayoutOptions.FillAndExpand;
            this.snookerBreakControl.DoneLeft         += snookerBreakControl_DoneLeft;
            this.snookerBreakControl.DoneRight        += snookerBreakControl_DoneRight;
            this.snookerBreakControl.BallsChanged     += snookerBreakControl_BallsChanged;

            /// list of past breaks
            ///
            this.listOfBreaksInMatchControl                    = new ListOfBreaksInMatchControl();
            this.listOfBreaksInMatchControl.Padding            = new Thickness(Config.IsTablet ? 15 : 0, 0, Config.IsTablet ? 15 : 0, 0);
            this.listOfBreaksInMatchControl.UserTappedOnBreak += this.listOfBreaksInMatchControl_UserTappedOnBreak;
            this.labelPastBreaks = new SimpleButtonWithLittleDownArrow(false)
            {
                Text   = "Show previous",
                IsBold = false,
                //IsSmallerFont = true,
                HeightRequest     = heightOfLabelPastBreaks,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                IsVisible         = Config.App != MobileAppEnum.SnookerForVenues,
            };
            this.labelPastBreaks2 = new BybLabel()
            {
                IsVisible         = false,
                Text              = "",
                TextColor         = Config.ColorTextOnBackgroundGrayed,
                HeightRequest     = heightOfLabelPastBreaks,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };
            this.panelPastBreaks = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Start,
                Spacing           = 0,
                BackgroundColor   = Config.ColorBackground,//Color.Black,
                Children          =
                {
                    new BoxView()
                    {
                        HeightRequest   = 1,
                        BackgroundColor = Config.ColorBackground,
                    },
                    this.labelPastBreaks,
//                    new Frame
//                    {
//                        IsVisible = Config.App != MobileAppEnum.SnookerForVenues,
//                        HeightRequest = heightOfLabelPastBreaks,
//                        Padding = new Thickness(0),
//                        HorizontalOptions = LayoutOptions.Center,
//                        VerticalOptions = LayoutOptions.Start,
//                        HasShadow = false,
//                        BackgroundColor = Color.Transparent,
//                        Content = this.labelPastBreaks,
//                    },
                    this.labelPastBreaks2,
                    this.listOfBreaksInMatchControl,
                }
            };
            this.labelPastBreaks.Clicked += (s1, e1) => { this.panelPastBreaksTapped(); };
            this.panelPastBreaks.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() => { this.panelPastBreaksTapped(); })
            });

            /// content
            ///
            this.absoluteLayout = new AbsoluteLayout()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
            };
            this.absoluteLayout.Children.Add(this.panelTop);
            this.absoluteLayout.Children.Add(this.panelSecond);
            this.absoluteLayout.Children.Add(this.snookerBreakControl);
            this.absoluteLayout.Children.Add(this.panelPastBreaks);
            this.absoluteLayout.Children.Add(this.panelEnteringFrameScore);
            Content = this.absoluteLayout;

            this.Padding         = new Thickness(0, 0, 0, 0);
            this.BackgroundColor = Color.Black;

            this.snookerBreakControl.VoiceButtonControl.PageTopLevelLayout = absoluteLayout;
            this.snookerBreakControl.HelpButtonControl.PageTopLevelLayout  = absoluteLayout;
        }