public ActivityHeaderModel(ActivityHeader header, List <IDispersionSpan> dispersion) { Name = header.Name; Dispersion = dispersion; LastPointTime = header.LastPointTime; Duration = header.Duration; DistanceInMeters = header.DistanceInMeters; MaximumSpeed = header.MaximumSpeed; DisplayableStartTime = LastPointTime.ToLocalTime().ToSmartShortDate(); DisplayableDistance = (DistanceInMeters / 1000f).ToString("0.00"); DisplayableTimeSpan = $"{Duration:h\\:mm}"; DisplayableAverageSpeed = $"{((DistanceInMeters / 1000f) / Duration.TotalHours):0.0}"; }
public ActivityHeaderViewModel(ActivityHeader header, List <IDispersionSpan> dispersion) { AthleteName = header.AthleteName; Sport = header.Sport; Dispersion = dispersion; LastPointTime = header.LastPointTime; Duration = header.Duration; DistanceInMeters = header.DistanceInMeters; CaloriesBurnt = header.CaloriesBurnt; AverageHeartRate = header.AverageHeartRate; MaximumHeartRate = header.MaximumHeartRate; MaximumSpeed = header.MaximumSpeed; DisplayableCaloriesBurnt = CaloriesBurnt == 0 ? AppResources.NoValue : CaloriesBurnt.ToString(); DisplayableStartTime = LastPointTime.ToLocalTime().ToSmartShortDate(); DisplayableDistance = (DistanceInMeters / 1000f).ToString("0.00"); DisplayableTimeSpan = $"{Duration:h\\:mm}"; DisplayableAverageSpeed = $"{((DistanceInMeters / 1000f) / Duration.TotalHours):0.0}"; DisplayableAverageHeartRate = AverageHeartRate == null ? AppResources.NoValue : AverageHeartRate.Value.ToString(); }