示例#1
0
        private void SetupWeeksProgress()
        {
            LineChart lineChart = null;

            try
            {
                if (_weeksProgress != null)
                {
                    var fromDate = DateTime.Now.AddDays(-7);
                    var toDate   = DateTime.Now;
                    lineChart = new LineChart(this);
                    var progressHelper = new ProgressChartHelper(this, _weeksProgress, lineChart);
                    _weeksProgress = progressHelper.SetupLineChart();
                    lineChart      = progressHelper.SetupChartData(fromDate, toDate);
                }

                if (_weeksProgressLabel != null)
                {
                    if (lineChart != null && lineChart.LineData.YMax < 0.002)
                    {
                        _weeksProgressLabel.Text = GetString(Resource.String.SummaryNoThoughtData);
                    }
                    else
                    {
                        _weeksProgressLabel.Text = GetString(Resource.String.MainActivityMyProgressLabel);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "SetupWeeksProgress: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorMainActivityWeeksProgress), "SummaryActivity.SetupWeeksProgress");
                }
            }
        }
示例#2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                SetContentView(Resource.Layout.MyProgressLayout);

                GetFieldComponents();

                _toolbar = ToolbarHelper.SetupToolbar(this, Resource.Id.myProgressToolbar, Resource.String.MyProgressToolbarTitle, Color.White);

                _chartHelper = new ProgressChartHelper(this, _progressLineChartContainer, _progressChart);

                _progressLineChartContainer = _chartHelper.SetupLineChart();

                var startDate = Intent.Extras.GetString("StartDate");
                Log.Info(TAG, "OnCreate: Start date for chart data - " + startDate);
                var endDate = Intent.Extras.GetString("EndDate");
                Log.Info(TAG, "OnCreate: End date for chart data - " + endDate);
                var actualStartDate = Convert.ToDateTime(startDate);
                var actualEndDate   = Convert.ToDateTime(endDate);

                _progressChart = _chartHelper.SetupChartData(actualStartDate, actualEndDate);

                Log.Info(TAG, "OnCreate: Successful completion");
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreate: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, "Creating Activity", "MyProgressActivity.OnCreate");
                }
            }
        }