Ejemplo n.º 1
0
        public TeleOpMatchScoutingPage(MatchData data, int matchType)
        {
            mType     = matchType;
            matchData = data;

            Title = "TeleOp Mode";

            Label teamNumberLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Text            = "Team: " + matchData.teamNumber.ToString(),
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            teleOpPressureLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text            = "Pressure: " + (matchData.autoPressure),
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            teleOpGearLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Text            = "Gears: " + ((matchData.autoGearScored ? 1 : 0)),
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            actionCounter = new SingleCounter("Actions");

            pressureCounter = new MultiCounter("Pressure");
            pressureCounter.PropertyChanged += (sender, e) => {
                teleOpPressureLbl.Text = "Total Pressure: " + (matchData.autoPressure + pressureCounter.getValue());
            };

            gearCounter = new SingleCounter("Gears");
            gearCounter.PropertyChanged += (sender, e) => {
                actionCounter.addToLowerLimit(gearCounter.getValue());
            };

            var finishBtn = new Button()
            {
                Text = "FINISH",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                FontSize          = GlobalVariables.sizeMedium,
                FontAttributes    = FontAttributes.Bold,
                BackgroundColor   = Color.Yellow
            };

            finishBtn.Clicked += (sender, e) => {
                saveData();
                Navigation.PushModalAsync(new PostMatchScoutingPage(matchData, mType));
            };

            var topBar = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Color.Green,
                Spacing           = 0,
            };

            topBar.Children.Add(teamNumberLbl);
            topBar.Children.Add(teleOpPressureLbl);
            topBar.Children.Add(teleOpGearLbl);

            pageLayout.Children.Add(actionCounter, 0, 0);
            pageLayout.Children.Add(pressureCounter, 1, 2, 0, 2);
            pageLayout.Children.Add(gearCounter, 2, 0);

            pageLayout.Children.Add(finishBtn, 1, 2, 3, 4);

            Content = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = 0,

                Children =
                {
                    topBar,
                    new ScrollView()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        IsClippedToBounds = true,

                        Content = pageLayout
                    }
                }
            };
        }
        public PostMatchScoutingPage(MatchData data, int matchType)
        {
            Title     = "Post Match";
            matchData = data;
            mType     = matchType;

            Label teamNumberLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Text            = "Team: " + matchData.teamNumber.ToString(),
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            pressureLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text            = "Pressure: " + (matchData.autoPressure + matchData.teleOpPressure),
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            gearLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Text            = "Gears: " + ((matchData.autoGearScored ? 1 : 0) + matchData.teleOpGearsScored),
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };


            climbSuccessBtn = new TitledColorButton("Climbing", "Success");

            goodCheck = new CheckBox()
            {
                DefaultText = "Did this team perform well?",
                FontSize    = GlobalVariables.sizeSmall
            };

            fullDisableBtn         = new TitledColorButton("Full Disable", "Disabled");
            partialDisablesCounter = new SingleCounter("Partial Disables");

            foulCounter = new SingleCounter("Fouls");

            var foulNotesLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text           = "Foul Notes",
                TextColor      = Color.Black,
                FontSize       = GlobalVariables.sizeMedium,
                FontAttributes = FontAttributes.Bold
            };

            foulNotes = new Editor()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.Gray
            };

            pilotErrorBtn = new TitledColorButton("Pilot Error", "Error");

            var finishMatchBtn = new Button()
            {
                Text            = "Save Match Data",
                FontSize        = GlobalVariables.sizeMedium,
                BackgroundColor = Color.Green,
            };

            finishMatchBtn.Clicked += (sender, e) => {
                finishMatch();
            };

            var topBar = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Color.Green,
                Spacing           = 0,
            };

            topBar.Children.Add(teamNumberLbl);
            topBar.Children.Add(pressureLbl);
            topBar.Children.Add(gearLbl);

            pageLayout.Children.Add(climbSuccessBtn, 0, 0);
            pageLayout.Children.Add(pilotErrorBtn, 0, 1);
            pageLayout.Children.Add(goodCheck, 0, 2);
            pageLayout.Children.Add(fullDisableBtn, 1, 0);
            pageLayout.Children.Add(partialDisablesCounter, 1, 1);
            pageLayout.Children.Add(foulCounter, 2, 0);
            pageLayout.Children.Add(foulNotesLbl, 2, 1);
            pageLayout.Children.Add(foulNotes, 2, 3, 1, 4);

            pageLayout.Children.Add(finishMatchBtn, 1, 2, 5, 6);

            Content = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = 0,

                Children =
                {
                    topBar,
                    new ScrollView()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        IsClippedToBounds = true,

                        Content = pageLayout
                    }
                }
            };
        }