Beispiel #1
0
        public string[] FillDataInSummaryTable(Dictionary <string, object> _hrData, string endTime, Dictionary <string, string> _param = null)
        {
            double startDate = 0;

            try
            {
                startDate = TimeSpan.Parse(_param["StartTime"]).TotalSeconds;
            }
            catch (Exception e)
            {
                startDate = 0;
            }

            double endDate   = !string.IsNullOrEmpty(endTime) ? TimeSpan.Parse(endTime).TotalSeconds : 0;
            double totalTime = endDate - startDate;

            string averageSpeed         = Summary.FinDAverageSpeed(_hrData["speed"] as List <string>).ToString();
            string totalDistanceCovered = ((Convert.ToDouble(averageSpeed) * totalTime) / 360).ToString();
            string maxSpeed             = Summary.FindMaxSpeed(_hrData["speed"] as List <string>).ToString();

            string averageHeartRate = Summary.FindAverageHeartRate(_hrData["heartRate"] as List <string>).ToString();
            string maximumHeartRate = Summary.FindMaxHeartRate(_hrData["heartRate"] as List <string> as List <string>).ToString();
            string minHeartRate     = Summary.FindMinHeartRate(_hrData["heartRate"] as List <string>).ToString();

            string averagePower = Summary.FindAveragePower(_hrData["watt"] as List <string>).ToString();
            string maxPower     = Summary.FindMaxPower(_hrData["watt"] as List <string>).ToString();

            string averageAltitude = Summary.FindAverageAltitude(_hrData["altitude"] as List <string>).ToString();
            string maximumAltitude = Summary.FindAverageAltitude(_hrData["altitude"] as List <string>).ToString();

            string[] summarydata = new string[] { totalDistanceCovered, averageSpeed, maxSpeed, averageHeartRate, maximumHeartRate, minHeartRate, averagePower, maxPower, averageAltitude, maximumAltitude };

            return(summarydata);
        }
        private void viewSummary()
        {
            //data from summary class

            double startDate = TimeSpan.Parse(_param["StartTime"]).TotalSeconds;
            double endDate   = TimeSpan.Parse(_endTime).TotalSeconds;
            double totalTime = endDate - startDate;


            string averageSpeed = Summary.FinDAverageSpeed(_hrData["speed"]).ToString();
            string maxSpeed     = Summary.FindMaxSpeed(_hrData["cadence"]).ToString();


            totalDistanceCovered = (Convert.ToDouble(averageSpeed) * totalTime).ToString();

            string averageHeartRate = Summary.FindAverageHeartRate(_hrData["heartRate"]).ToString();
            string maximumHeartRate = Summary.FindMaxHeartRate(_hrData["heartRate"]).ToString();
            string minHeartRate     = Summary.FindMinHeartRate(_hrData["heartRate"]).ToString();

            string averagePower = Summary.FindAveragePower(_hrData["watt"]).ToString();
            string maxPower     = Summary.FindMaxPower(_hrData["watt"]).ToString();

            string averageAltitude = Summary.FindAverageAltitude(_hrData["altitude"]).ToString();


            //labels for summarized data
            lbltotaldistance.Text = "Total Distance Covered: " + totalDistanceCovered;
            lblavgspeed.Text      = "Average Speed: " + averageSpeed;
            lblmaxspeed.Text      = "Maximum Speed: " + maxSpeed;
            lblavgheart.Text      = "Average Heart Rate: " + averageHeartRate;
            lblmaxheart.Text      = "Maximum Heart Rate: " + maximumHeartRate;
            lblminheart.Text      = "Minimum Heart Rate: " + minHeartRate;
            lblavgpower.Text      = "Average Power: " + averagePower;
            lblmaxpower.Text      = "Maximum Power: " + maxPower;
            lblavgalt.Text        = "Average Altitude: " + averageAltitude;
        }