Example #1
0
        private async Task Init()
        {
            _viewModel = new CountyStandingsViewModel();

            BindingContext = _viewModel;

            _viewModel.GetChapters();
            _viewModel.GetYears();
            _viewModel.GetYearFractions();

            var lblChapter = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Indicator:"
            };

            _pickerChapters = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var chapter in _viewModel.ChapterList)
            {
                _pickerChapters.Items.Add(chapter.Key);
            }

            var lblYear = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "An:"
            };

            _pickerYears = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var year in _viewModel.YearList)
            {
                _pickerYears.Items.Add(year);
            }

            var lblYearFraction = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Luna:"
            };

            _pickerYearFractions = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var yearFraction in _viewModel.YearFractionList)
            {
                _pickerYearFractions.Items.Add(yearFraction);
            }

            var degStandings = new GridControl();

            degStandings.IsReadOnly        = true;
            degStandings.HorizontalOptions = LayoutOptions.FillAndExpand;
            degStandings.Columns.Add(new TextColumn()
            {
                Caption = "Pozitie", FieldName = "Position", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            degStandings.Columns.Add(new TextColumn()
            {
                Caption = "Judet", FieldName = "County", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            var valueColumn = new TextColumn()
            {
                FieldName  = "Value",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn.SetBinding(TextColumn.CaptionProperty, new Binding("ValueColumnCaption", source: _viewModel));
            degStandings.Columns.Add(valueColumn);
            degStandings.ItemsSource = _viewModel.Standings;
            degStandings.RowTap     += degAverageGrosSalary_RowTap;
            degStandings.SetBinding(GridControl.IsVisibleProperty, "HasData");

            var lblNoData = new Label()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text = "Nu exista date disponibile pentru intervalul selectat",
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize = 27,
            };
            var btnForceDataLoading = new Button()
            {
                Text = "Forteaza incarcarea datelor",
            };

            btnForceDataLoading.Clicked += btnForceDataLoading_Clicked;

            var stackNoData = new StackLayout()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 20,
                Padding         = new Thickness(0),
                Children        =
                {
                    lblNoData,
                    btnForceDataLoading
                }
            };

            stackNoData.SetBinding(Label.IsVisibleProperty, "DoesNotHaveData");

            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    top: Device.OnPlatform(iOS: 20, Android: 5, WinPhone: 0)),
                Children =
                {
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Padding           = new Thickness(0, 2),
                        Children          =
                        {
                            lblChapter, _pickerChapters
                        }
                    },
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            lblYear, _pickerYears, lblYearFraction, _pickerYearFractions
                        }
                    },
                    degStandings,
                    stackNoData
                }
            };

            _pickerChapters.SelectedIndex      = Settings.StandingsChapter;
            _pickerYears.SelectedIndex         = _pickerYears.Items.IndexOf(App.LastYearAvailableData.ToString());
            _pickerYearFractions.SelectedIndex = _pickerYearFractions.Items.IndexOf(App.LastMonthAvailableData.ToString());

            _pickerChapters.SelectedIndexChanged      += pickerChapters_SelectedIndexChanged;
            _pickerYears.SelectedIndexChanged         += _pickerYears_SelectedIndexChanged;
            _pickerYearFractions.SelectedIndexChanged += _pickerYearFractions_SelectedIndexChanged;

            await LoadData();
        }
Example #2
0
        private async Task Init()
        {
            _viewModel = new CountyDetailsViewModel();
            await _viewModel.GetCounties();

            _viewModel.GetChapters();

            var lblCounty = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Judet:"
            };

            _pickerCounties = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var county in _viewModel.CountyList)
            {
                _pickerCounties.Items.Add(county.Key);
            }

            var lblCompare = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "compara cu"
            };

            _pickerCounties2 = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            _pickerCounties2.Items.Add("──────");
            foreach (var county in _viewModel.CountyList)
            {
                _pickerCounties2.Items.Add(county.Key);
            }

            var lblChapter = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Indicator:"
            };

            _pickerChapters = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var chapter in _viewModel.ChapterList)
            {
                _pickerChapters.Items.Add(chapter.Key);
            }

            degChapterData                   = new GridControl();
            degChapterData.IsReadOnly        = true;
            degChapterData.HorizontalOptions = LayoutOptions.FillAndExpand;
            degChapterData.VerticalOptions   = LayoutOptions.FillAndExpand;
            degChapterData.Columns.Add(new TextColumn()
            {
                Caption = "An", FieldName = "Year", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            degChapterData.Columns.Add(new TextColumn()
            {
                Caption = "Luna", FieldName = "YearFraction", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            var valueColumn = new TextColumn()
            {
                FieldName  = "Value",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn.SetBinding(TextColumn.CaptionProperty, new Binding("ValueColumnCaption", source: _viewModel));
            degChapterData.Columns.Add(valueColumn);
            var valueColumn2 = new TextColumn()
            {
                FieldName  = "Value2",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn2.SetBinding(TextColumn.CaptionProperty, new Binding("Value2ColumnCaption", source: _viewModel));
            valueColumn2.SetBinding(TextColumn.IsVisibleProperty, new Binding("Value2ColumnVisibility", source: _viewModel));
            degChapterData.Columns.Add(valueColumn2);
            degChapterData.ItemsSource = _viewModel.ChapterDataReversed;
            degChapterData.RowTap     += degChapterData_RowTap;

            plotView = new PlotView();
            plotView.HorizontalOptions = LayoutOptions.FillAndExpand;
            plotView.VerticalOptions   = LayoutOptions.FillAndExpand;
            plotView.Model             = new PlotModel();
            var series = new LineSeries();

            series.ItemsSource = _viewModel.ChapterData;
            plotView.Model.Series.Add(series);
            plotView.Model.Title     = "Evolutie indicator";
            plotView.BackgroundColor = Color.FromRgb(51, 51, 51);

            dataControls = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = 0,
                Children          = { degChapterData, plotView }
            };

            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    top: Device.OnPlatform(iOS: 20, Android: 5, WinPhone: 0)),
                Children =
                {
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Padding           = new Thickness(0, 2),
                        Children          =
                        {
                            lblCounty, _pickerCounties, lblCompare, _pickerCounties2
                        }
                    },
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            lblChapter, _pickerChapters
                        }
                    },
                    //degChapterData,
                    //plotView
                    dataControls
                }
            };

            _pickerCounties.SelectedIndex    = Settings.County1;
            _pickerCounties2.SelectedIndex   = Settings.County2;
            _pickerChapters.SelectedIndex    = Settings.Chapter;
            degChapterData.SelectedRowHandle = -1;

            _pickerCounties.SelectedIndexChanged  += pickerCounties_SelectedIndexChanged;
            _pickerCounties2.SelectedIndexChanged += _pickerCounties2_SelectedIndexChanged;
            _pickerChapters.SelectedIndexChanged  += pickerChapters_SelectedIndexChanged;

            await LoadData();
        }
Example #3
0
        private async Task Init()
        {
            _viewModel = new CountyDetailsViewModel();
            await _viewModel.GetCounties();

            _viewModel.GetChapters();

            var lblCounty = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Judet:"
            };

            _pickerCounties = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var county in _viewModel.CountyList)
            {
                _pickerCounties.Items.Add(county.Key);
            }
            _pickerCounties.SelectedIndexChanged += pickerCounties_SelectedIndexChanged;

            var lblChapter = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Indicator:"
            };

            _pickerChapters = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var chapter in _viewModel.ChapterList)
            {
                _pickerChapters.Items.Add(chapter.Key);
            }
            _pickerChapters.SelectedIndexChanged += pickerChapters_SelectedIndexChanged;

            await LoadData();

            degChapterData                   = new GridControl();
            degChapterData.IsReadOnly        = true;
            degChapterData.HorizontalOptions = LayoutOptions.FillAndExpand;
            degChapterData.VerticalOptions   = LayoutOptions.FillAndExpand;
            degChapterData.Columns.Add(new TextColumn()
            {
                Caption = "An", FieldName = "Year", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            degChapterData.Columns.Add(new TextColumn()
            {
                Caption = "Luna", FieldName = "YearFraction", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            var valueColumn = new TextColumn()
            {
                FieldName  = "Value",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn.SetBinding(TextColumn.CaptionProperty, new Binding("ValueColumnCaption", source: _viewModel));
            degChapterData.Columns.Add(valueColumn);
            degChapterData.ItemsSource = _viewModel.ChapterDataReversed;

            plotView = new PlotView();
            plotView.HorizontalOptions = LayoutOptions.FillAndExpand;
            plotView.VerticalOptions   = LayoutOptions.FillAndExpand;
            plotView.Model             = new PlotModel();
            var series = new LineSeries();

            series.ItemsSource = _viewModel.ChapterData;
            plotView.Model.Series.Add(series);

            dataControls = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { degChapterData, plotView }
            };

            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    top: Device.OnPlatform(iOS: 20, Android: 0, WinPhone: 0)),
                Children =
                {
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            lblCounty, _pickerCounties
                        }
                    },
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            lblChapter, _pickerChapters
                        }
                    },
                    //degChapterData,
                    //plotView
                    dataControls
                }
            };

            _pickerCounties.SelectedIndex = 0;
            _pickerChapters.SelectedIndex = 0;
        }
        private async Task Init()
        {
            _viewModel = new CountyStandingsViewModel();
            _viewModel.GetChapters();
            _viewModel.GetYears();
            _viewModel.GetYearFractions();

            var lblChapter = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Indicator:"
            };

            _pickerChapters = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var chapter in _viewModel.ChapterList)
            {
                _pickerChapters.Items.Add(chapter.Key);
            }
            _pickerChapters.SelectedIndexChanged += pickerChapters_SelectedIndexChanged;

            var lblYear = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "An:"
            };

            _pickerYears = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var year in _viewModel.YearList)
            {
                _pickerYears.Items.Add(year);
            }
            _pickerYears.SelectedIndexChanged += _pickerYears_SelectedIndexChanged;

            var lblYearFraction = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Luna / semestru / trimestru:"
            };

            _pickerYearFractions = new Picker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var yearFraction in _viewModel.YearFractionList)
            {
                _pickerYearFractions.Items.Add(yearFraction);
            }
            _pickerYearFractions.SelectedIndexChanged += _pickerYearFractions_SelectedIndexChanged;

            await LoadData();

            var degAverageGrosSalary = new GridControl();

            degAverageGrosSalary.IsReadOnly        = true;
            degAverageGrosSalary.HorizontalOptions = LayoutOptions.FillAndExpand;
            degAverageGrosSalary.Columns.Add(new TextColumn()
            {
                Caption = "Pozitie", FieldName = "Position", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            degAverageGrosSalary.Columns.Add(new TextColumn()
            {
                Caption = "Judet", FieldName = "County", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            var valueColumn = new TextColumn()
            {
                FieldName  = "Value",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn.SetBinding(TextColumn.CaptionProperty, new Binding("ValueColumnCaption", source: _viewModel));
            degAverageGrosSalary.Columns.Add(valueColumn);
            degAverageGrosSalary.ItemsSource = _viewModel.Standings;

            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    top: Device.OnPlatform(iOS: 20, Android: 0, WinPhone: 0)),
                Children =
                {
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            lblChapter, _pickerChapters
                        }
                    },
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Children          =
                        {
                            lblYear, _pickerYears, lblYearFraction, _pickerYearFractions
                        }
                    },
                    degAverageGrosSalary,
                }
            };

            _pickerChapters.SelectedIndex = 0;
        }