Exemplo n.º 1
0
        private async void LoadData()
        {
            RunOnUiThread(() =>
            {
                progressBar.Visibility    = ViewStates.Visible;
                progressBar.Indeterminate = true;
            });
            try
            {
                var items = await BarHelper.GenerateData(viewModel, Resources.GetColor(Resource.Color.bar_up),
                                                         Resources.GetColor(Resource.Color.bar_down));


                RunOnUiThread(() =>
                {
                    if (items.Count == 0)
                    {
                        MessageDialog.SendMessage(this, "There is no data for this group, please check in a few members first to a meetup.", "No Statistics");
                        return;
                    }
                    else if (viewModel.GroupsEventsCount.ContainsKey(0))
                    {
                        MessageDialog.SendMessage(this, "Data for group needs synced, please re-visit all meetups to synchronize data and return for in depth statistics.", "No Statistics");
                    }

                    barChart.ItemsSource = items;
                    barChart.Invalidate();
                });
            }
            finally
            {
                RunOnUiThread(() =>
                {
                    progressBar.Visibility    = ViewStates.Gone;
                    progressBar.Indeterminate = false;
                });
            }
        }