private void UpdateData()
        {
            ResetValues();

            DailyRecord   record;
            List <Record> tempList;
            DateTime      date = (DateTime.Now - TimeSpan.FromDays(_day));

            record = SelectedUser.FindRecord(date, true);
            if (record != null)
            {
                tempList = record.Records;

                DateTime startDate = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);

                if (tempList != null && tempList.Count > 0)
                {
                    for (int i = 0; i < 24; i++)
                    {
                        var hrec    = record.GetHourlyRecord(i, true);
                        int walking = (hrec == null || hrec.ActivityType != 0 ? 0 : _counter.GetWalkingCalorieBurn(hrec));
                        int hourly  = (hrec == null ? ((startDate.Date == DateTime.Now.Date && i > date.Hour) ? 0 : _counter.CalcHourlyBMR(startDate)) : _counter.AdjustedBMR(hrec));

                        areaChartData[i].value2 += hourly + walking;

                        _walkingCalories += walking;
                        _passiveCalories += hourly;

                        startDate += TimeSpan.FromHours(1);
                    }

                    foreach (Record hrec in tempList)
                    {
                        int activity = (hrec == null || hrec.ActivityType == 0 ? 0 : (int)((double)_counter.RawBMR() * 1.157407407407407e-5 * (double)hrec.WalkTime
                                                                                           * hrec.RealActivity.metaEquivalent)); //BMR per second
                        areaChartData[hrec.StartDate.Hour].value2 += activity;
                        _walkingCalories += activity;
                    }
                }
            }

            OnPropertyChanged(null);
            ChartData.UpdateCollection();
        }
        private void UpdateData()
        {
            DateTime selectedWeek = FirstDayOfWeek(DateTime.Now - (TimeSpan.FromDays(7 * _day)));

            WeeklyData.Clear();

            for (int i = 0; i < 7; i++)
            {
                DailyRecord record;
                record = SelectedUser.FindRecord(selectedWeek + TimeSpan.FromDays(i), true);

                ChartData[i].value1 = (selectedWeek + TimeSpan.FromDays(i)).Day;
                ChartData[i].value2 = 0;

                if (record != null)
                {
                    Record sumRec = record.SummarizeRecord();
                    WeeklyData.Add(sumRec);

                    DateTime startDate = new DateTime(record.Date.Year, record.Date.Month, record.Date.Day, 0, 0, 0);

                    //24 hrs a day
                    for (int a = 0; a < 24; a++)
                    {
                        var hrec    = record.GetHourlyRecord(a, true);
                        int walking = (hrec == null || hrec.ActivityType != 0 ? 0 : _counter.GetWalkingCalorieBurn(hrec));
                        int hourly  = (hrec == null ? ((startDate.Date == DateTime.Now.Date && a > DateTime.Now.Hour) ? 0 : _counter.CalcHourlyBMR(startDate)) : _counter.AdjustedBMR(hrec));

                        areaChartData[i].value2 += hourly + walking;

                        startDate += TimeSpan.FromHours(1);
                    }

                    foreach (Record hrec in record.Records)
                    {
                        int activity = (hrec == null || hrec.ActivityType == 0 ? 0 : (int)((double)_counter.RawBMR() * 1.157407407407407e-5 * (double)hrec.WalkTime
                                                                                           * hrec.RealActivity.metaEquivalent)); //BMR per second
                        areaChartData[i].value2 += activity;
                    }
                }
            }

            OnPropertyChanged(null);
            ChartData.UpdateCollection();
        }