/// <summary> /// Gets the activity level information for the given activity level. /// </summary> /// <param name="level">The activity level to get the information for.</param> /// <returns>The activity level information</returns> /// <exception cref="Exception">If the given activity level is not supported.</exception> public ActivityLevel getActivityLevel(ActivityLevels level) { foreach (ActivityLevel alevel in this.activityLevels) { if (alevel.Level == level) { if (this.model.Count != 0) { alevel.Percent = (alevel.Count / (this.model.Count / (double)this.Steps)) * 100.0; } return alevel; } } throw new Exception("Unsupported activitylevel" + level.ToString()); }
// Helper function to add one count to a given activity level. private void addCount(ActivityLevels level) { foreach (ActivityLevel alevel in this.activityLevels) { if (alevel.Level == level) { alevel.Count++; return; } } }
public void SetActivityLevel(ActivityLevels activityLevel) { this.activityLevel = activityLevel; }