Esempio 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 AutoMatchScoutingPage(MatchData data, int matchType)
        {
            matchData = data;
            mType     = matchType;

            Title = "Autonomous 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
            };

            autoPressureLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text            = "Total Pressure: 0",
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            autoGearLbl = new Label()
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Text            = "Total Gears: 0",
                TextColor       = Color.White,
                BackgroundColor = Color.Green,
                FontSize        = GlobalVariables.sizeSmall,
                FontAttributes  = FontAttributes.Bold
            };

            inputs[0] = new TitledColorButton("Crossing", "CROSSED");
            inputs[1] = new TitledColorButton("Gears", "Gear Scored");
            inputs[1].PropertyChanged += (sender, e) => {
                autoGearLbl.Text = "Total Gears: " + (inputs[1].getBtnStatus() ? 1 : 0);
            };
            pressureCounter = new MultiCounter("Pressure");
            pressureCounter.PropertyChanged += (sender, e) => {
                autoPressureLbl.Text = "Total Pressure: " + pressureCounter.getValue();
            };

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

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


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

            topBar.Children.Add(teamNumberLbl);
            topBar.Children.Add(autoPressureLbl);
            topBar.Children.Add(autoGearLbl);

            pageLayout.Children.Add(inputs[0], 0, 0);
            pageLayout.Children.Add(pressureCounter, 1, 2, 0, 2);
            pageLayout.Children.Add(inputs[1], 2, 0);

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

            BackgroundColor = Color.Teal;

            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
                    }
                }
            };
        }