Ejemplo n.º 1
0
 public void seticon(parameters ppara)
 {
     parameter  = ppara;
     label.text = parameter.ToString();
 }
        public StatComparsionPage()
        {
            Grid layoutGrid = new Grid()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(150, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            Label titleLabel = new Label {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                TextColor         = Color.White,
                FontSize          = GlobalVariables.sizeTitle,
                FontAttributes    = FontAttributes.Bold,
                Text = "All Teams"
            };

            // Def Filter
            Button autoFilterBtn = new Button()
            {
                Text            = "Show Def",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            autoFilterBtn.Clicked += (object sender, EventArgs e) => {
                filterArray = new bool[3] {
                    true, false, false
                };
                populateData(null);
            };

            // Shot Filter
            Button teleOpFilterBtn = new Button()
            {
                Text            = "Show Shots",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            teleOpFilterBtn.Clicked += (object sender, EventArgs e) => {
                filterArray = new bool[3] {
                    false, true, false
                };
                populateData(null);
            };

            // Other Filter
            Button defenseFilterBtn = new Button()
            {
                Text            = "Show Other",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            defenseFilterBtn.Clicked += (object sender, EventArgs e) => {
                filterArray = new bool[3] {
                    false, false, true
                };
                populateData(null);
            };

            Picker parameterPicker = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Title             = "Select a Parameter"
            };

            for (parameters i = parameters.Low_Bar; i <= parameters.Fouls; i++)
            {
                parameterPicker.Items.Add(i.ToString());
            }
            ;
            parameterPicker.SelectedIndexChanged += (sender, e) => {
                parameters select = (parameters)parameterPicker.SelectedIndex;
                parameterPicker.Title = select.ToString();
            };

            // Sort Button
            Button sortBtn = new Button()
            {
                Text            = "Sort by Parameter",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            sortBtn.Clicked += (object sender, EventArgs e) => {
                if (new CheckInternetConnectivity().InternetStatus())
                {
                    if (parameterPicker.SelectedIndex == -1)
                    {
                        DisplayAlert("Error", "Select a Parameter", "OK");
                    }
                    else
                    {
                        populateData(((parseString)parameterPicker.SelectedIndex).ToString());
                    }
                }
            };


            //Reset Filters
            Button resetFilterBtn = new Button()
            {
                Text            = "Reset Filters",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            resetFilterBtn.Clicked += (object sender, EventArgs e) => {
                filterArray = new bool[3] {
                    true, true, true
                };
                populateData(null);
            };

            // Filter Buttons
            StackLayout filterBtns = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Color.Green,
                Padding           = 5,

                Children =
                {
                    autoFilterBtn,
                    teleOpFilterBtn,
                    defenseFilterBtn,
                    resetFilterBtn,
                    parameterPicker,
                    sortBtn
                }
            };

            //Refresh Button
            Button refreshBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Refresh",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            refreshBtn.Clicked += (object sender, EventArgs e) => {
                if (new CheckInternetConnectivity().InternetStatus())
                {
                    populateData(null);
                }
            };

            //Back Button
            Button backBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Back",
                TextColor       = Color.Green,
                BackgroundColor = Color.Black
            };

            backBtn.Clicked += (object sender, EventArgs e) => {
                Navigation.PopModalAsync();
            };

            // Navigation Panel
            StackLayout navigationBtns = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Color.Green,
                Padding           = 5,

                Children =
                {
                    backBtn,
                    refreshBtn
                }
            };

            dataHorizontalScroll = new ScrollView()
            {
                Orientation = ScrollOrientation.Horizontal,

                Content = dataHolder
            };

            Console.WriteLine("Scroll Size: " + dataVerticalScroll.ContentSize.ToString());

            layoutGrid.Children.Add(dataHorizontalScroll, 0, 2, 1, 2);
            layoutGrid.Children.Add(titleLabel, 0, 0);
            layoutGrid.Children.Add(busyIcon, 1, 0);
            layoutGrid.Children.Add(filterBtns, 0, 2, 2, 3);
            layoutGrid.Children.Add(navigationBtns, 0, 2, 3, 4);

            this.Content = new StackLayout {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,

                Children =
                {
                    layoutGrid
                }
            };
            if (new CheckInternetConnectivity().InternetStatus())
            {
                populateData(null);
            }
        }
Ejemplo n.º 3
0
 void Start()
 {
     val        = 1;
     label.text = parameter.ToString();
 }