Example #1
0
        // Crear paginas bases
        private void CrearPage(int posicion)
        {
            // Content
            vChart[posicion] = new ChartViewBase(menuInferior[posicion].GetButtons[0]);

            stackLayoutChart[posicion] = new StackLayout();
            stackLayoutChart[posicion].Children.Add(vChart[posicion].GetChart);
            stackLayoutChart[posicion].Margin            = 0;
            stackLayoutChart[posicion].VerticalOptions   = LayoutOptions.FillAndExpand;
            stackLayoutChart[posicion].HorizontalOptions = LayoutOptions.FillAndExpand;

            // Grid Principal

            grid[posicion].ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            switch (Device.RuntimePlatform)
            {
            case Device.Android:
            case Device.UWP:
                grid[posicion].RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.88, GridUnitType.Star)
                });
                grid[posicion].Children.Add(stackLayoutChart[posicion], 0, 0);
                grid[posicion].RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.12, GridUnitType.Star)
                });
                grid[posicion].Children.Add(menuInferior[posicion].GetScrollView, 0, 1);
                break;

            case Device.iOS:
                grid[posicion].RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.08, GridUnitType.Star)
                });
                grid[posicion].RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(0.92, GridUnitType.Star)
                });
                grid[posicion].Children.Add(stackLayoutChart[posicion], 0, 1);
                grid[posicion].Children.Add(menuInferior[posicion].GetScrollView, 0, 0);
                break;
            }

            grid[posicion].HorizontalOptions = LayoutOptions.FillAndExpand;
            grid[posicion].VerticalOptions   = LayoutOptions.FillAndExpand;
            grid[posicion].ColumnSpacing     = 0;
            grid[posicion].RowSpacing        = 0;

            contentPage[posicion].Content = grid[posicion];

            AsignarClickEvent(posicion);
        }
        private void CrearChart1VegadaPagina()
        {
            grid             = new Grid();
            stackLayoutChart = new StackLayout();

            this.ToolbarItems.Add(InicialitzarAboutChartToolbar());
            if (valorInicial != 5 && valorInicial != 7 && valorInicial != 8 && valorInicial != 9 && valorInicial != 11 && valorInicial != 12 && valorInicial != 13)
            {
                if (Device.RuntimePlatform != Device.UWP)
                {
                    this.ToolbarItems.Add(InicialitzarConfigToolBar());
                }
            }

            // StackLayout del "Chart"
            stackLayoutChart.Margin            = 0;
            stackLayoutChart.VerticalOptions   = LayoutOptions.FillAndExpand;
            stackLayoutChart.HorizontalOptions = LayoutOptions.FillAndExpand;

            // "Grid" de la pestaƱa Types

            grid.HorizontalOptions = LayoutOptions.FillAndExpand;
            grid.VerticalOptions   = LayoutOptions.FillAndExpand;
            grid.ColumnSpacing     = 0;
            grid.RowSpacing        = 0;
            grid.Margin            = 0;

            switch (valorInicial)
            {
            case 3:
                menuInferior = new MenuInferior(var.GetCircularGaugesNomButtons);
                break;

            case 4:
                menuInferior = new MenuInferior(var.GetMapsNomButtons);
                break;

            case 5:
                menuInferior = new MenuInferior(var.GetTreeMapNomButtons);
                break;

            case 6:
                menuInferior = new MenuInferior(var.GetKnobGaugeNomButtons);
                break;

            case 7:
                menuInferior = new MenuInferior(var.GetClockNomButtons);
                break;

            case 8:
                menuInferior = new MenuInferior(var.GetOrganizationalNomButtons);
                break;

            case 9:
                menuInferior = new MenuInferior(var.GetNumericGaugeNomButtons);
                break;

            case 10:
                menuInferior = new MenuInferior(var.GetLinearGaugeNomButtons);
                break;

            case 11:
                menuInferior = new MenuInferior(var.GetCalendarNomButtons);
                break;

            case 12:
                menuInferior = new MenuInferior(var.GetSparkLinesNomButtons);
                break;

            case 13:
                menuInferior = new MenuInferior(var.GetTagCloudNomButtons);
                break;

            case 14:
                menuInferior = new MenuInferior(var.GetStandardFunctionsNomButtons);
                break;
            }

            this.Title = menuInferior.GetNomButtons[0];

            switch (valorInicial)
            {
            case 5:
            case 8:
            case 9:
            case 13:

                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                vChart = new ChartViewBase(this.Title);
                stackLayoutChart.Children.Add(vChart.GetChart);
                grid.Children.Add(stackLayoutChart, 0, 0);
                break;

            case 11:

                LabelSwipe labelHeader  = new LabelSwipe();
                Button     btnBackMonth = new Button();
                Button     btnNextMonth = new Button();

                btnBackMonth.Text              = "<";
                btnBackMonth.VerticalOptions   = LayoutOptions.FillAndExpand;
                btnBackMonth.HorizontalOptions = LayoutOptions.Start;
                btnBackMonth.WidthRequest      = 50;
                btnNextMonth.Text              = ">";
                btnNextMonth.VerticalOptions   = LayoutOptions.FillAndExpand;
                btnNextMonth.HorizontalOptions = LayoutOptions.End;
                btnNextMonth.WidthRequest      = 50;

                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                if (Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.UWP)
                {
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.11, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.79, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.11, GridUnitType.Star)
                    });

                    grid.Children.Add(labelHeader, 0, 0);
                    grid.Children.Add(btnBackMonth, 0, 0);
                    grid.Children.Add(btnNextMonth, 0, 0);
                    grid.Children.Add(stackLayoutChart, 0, 1);
                    grid.Children.Add(menuInferior.GetScrollView, 0, 2);
                }
                else
                {
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.08, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.81, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.11, GridUnitType.Star)
                    });

                    btnBackMonth.BorderWidth = 1;
                    btnBackMonth.BorderColor = Color.FromRgb(100, 100, 100);
                    btnNextMonth.BorderWidth = 1;
                    btnNextMonth.BorderColor = Color.FromRgb(100, 100, 100);
                    grid.Children.Add(labelHeader, 0, 2);
                    grid.Children.Add(btnBackMonth, 0, 2);
                    grid.Children.Add(btnNextMonth, 0, 2);
                    grid.Children.Add(stackLayoutChart, 0, 1);
                    grid.Children.Add(menuInferior.GetScrollView, 0, 0);
                }

                vChart = new ChartViewBase(this.Title, labelHeader);
                stackLayoutChart.Children.Add(vChart.GetChart);
                AsignarClickEvent(valorInicial);
                break;

            default:

                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                switch (Device.RuntimePlatform)
                {
                case Device.Android:
                case Device.UWP:
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.89, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.11, GridUnitType.Star)
                    });
                    grid.Children.Add(stackLayoutChart, 0, 0);
                    grid.Children.Add(menuInferior.GetScrollView, 0, 1);
                    break;

                case Device.iOS:
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.08, GridUnitType.Star)
                    });
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(0.92, GridUnitType.Star)
                    });
                    grid.Children.Add(stackLayoutChart, 0, 1);
                    grid.Children.Add(menuInferior.GetScrollView, 0, 0);
                    break;

                default:
                    throw new Exception("Unexpected Case");
                }

                vChart = new ChartViewBase(menuInferior.GetButtons[0]);
                stackLayoutChart.Children.Add(vChart.GetChart);

                AsignarClickEvent(valorInicial);
                break;
            }

            this.Content = grid;
        }