locked
ExerciseDetalis RRS feed

  • Question

  • I am uploading the exercise data using OMRON Pedometer. To display on my page, I am getting the date, duration, distance, activity as follows:
    List<Exercise> ExerciseList = GetValues<Exercise>(Exercise.TypeId);
    foreach (Exercise ExerciseItem in ExerciseList)
    {
    String date1 = ExerciseItem.When.ToString().Substring(0,10);
    DurationCell.Text = String.Format("{0:F2}", ExerciseItem.Duration.Value);
    ExerciseCell.Text = String.Format("{0:F2}", ExerciseItem.Distance.Value);
    //need Calories Burned here
    ActivityCell.Text = String.Format("{0}", ExerciseItem.Activity.ToString());
    }

    How do I get the corresponding CaloriesBurned_calories?
    I understand that it is part of
    ExerciseDetail Class, but can't figure out to get the corresponding values for each entry in the ExerciseList.

    Thanks.



    • Edited by deepkaur Monday, September 14, 2009 5:27 PM minor correction
    Monday, September 14, 2009 5:26 PM

Answers

  • Hello,

    Are you refering to the member, constant string, CaloriesBurned_calories? The definition is as following.
    public const string CaloriesBurned_calories = "CaloriesBurned_calories";

    You can retrieve the ExersiseDetails objects from each of the Exercise object itself. You can use the Details property. Once you get the ExersiseDetails object from Exercise you can access the string with dot operator directly.

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Monday, September 14, 2009 6:15 PM
  • The Details is of type IDictionary<string, ExerciseDetail>. So to get the Details values you will have to go through each of the values in the dictionary, like

    foreach(string aKey in ExerciseItem.Details.Keys)
    {
           //Retrieve the ExerciseDetails object using the aKey value
    }

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Monday, September 14, 2009 8:59 PM

All replies

  • Hello,

    Are you refering to the member, constant string, CaloriesBurned_calories? The definition is as following.
    public const string CaloriesBurned_calories = "CaloriesBurned_calories";

    You can retrieve the ExersiseDetails objects from each of the Exercise object itself. You can use the Details property. Once you get the ExersiseDetails object from Exercise you can access the string with dot operator directly.

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Monday, September 14, 2009 6:15 PM
  • Do you mean this?
    ExerciseItem.Details.ExerciseDetail.CaloriesBurned_calories

    Doesn't seem right as I don't see ExerciseDetail for ExerciseItem.Details

    Thank you.
    Monday, September 14, 2009 8:02 PM
  • The Details is of type IDictionary<string, ExerciseDetail>. So to get the Details values you will have to go through each of the values in the dictionary, like

    foreach(string aKey in ExerciseItem.Details.Keys)
    {
           //Retrieve the ExerciseDetails object using the aKey value
    }

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Monday, September 14, 2009 8:59 PM