本文整理汇总了C#中IActivity.GetCustomDataValue方法的典型用法代码示例。如果您正苦于以下问题:C# IActivity.GetCustomDataValue方法的具体用法?C# IActivity.GetCustomDataValue怎么用?C# IActivity.GetCustomDataValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActivity
的用法示例。
在下文中一共展示了IActivity.GetCustomDataValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomFields
private static string CustomFields(IActivity activity, ActivityInfo activityInfoInstance, string field)
{
string fieldValue = "";
ICustomDataFieldObjectType type = CustomDataFieldDefinitions.StandardObjectType(typeof(IActivity));
foreach (ICustomDataFieldDefinition definition in
CalculatedFields.GetLogBook().CustomDataFieldDefinitions)
{
if (definition.Name.ToUpper() == field && definition.ObjectType == type)
{
if (activity.GetCustomDataValue(definition) == null)
{
fieldValue = "null";
}
else
{
if (definition.DataType.Id == CustomDataFieldDefinitions.StandardDataTypes.NumberDataTypeId)
{
fieldValue = Double.Parse(activity.GetCustomDataValue(definition).ToString()).ToString(CultureInfo.InvariantCulture.NumberFormat);
}
else if (definition.DataType.Id == CustomDataFieldDefinitions.StandardDataTypes.TextDataTypeId)
{
fieldValue = activity.GetCustomDataValue(definition).ToString().Escape();
}
else if (definition.DataType.Id == CustomDataFieldDefinitions.StandardDataTypes.TimeSpanDataTypeId)
{
fieldValue = TimeSpan.Parse(activity.GetCustomDataValue(definition).ToString()).TotalSeconds.ToString(CultureInfo.InvariantCulture.NumberFormat);
}
}
}
}
return fieldValue;
}
示例2: boGetExported
public bool boGetExported(IActivity activity)
{
if (activity != null)
{
#if !ST_2_1
int? ExportedCustData = (int?)(activity.GetCustomDataValue(FunbeatExportedField) as double?);
#else
int? ExportedCustData = null;
#endif
// Upgrade from old to new method of marking an activity to be exported
if (ExportedCustData == null)
{
// Check if metadata string exists and update the cust data field
bool boExported = (activity.Metadata.Source.IndexOf("Funbeated") >= 0);
#if !ST_2_1
if (boExported)
activity.SetCustomDataValue(FunbeatExportedField, (double?)1.0);
else
activity.SetCustomDataValue(FunbeatExportedField, (double?)0.0);
#endif
return boExported;
}
else
{
return (ExportedCustData != 0);
}
}
else
return false;
}
示例3: AthleteFields
//.........这里部分代码省略.........
fieldValue = athleteEntry.SystolicBloodPressure.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETEINJURED":
fieldValue = athleteEntry.Injured.ToString();
break;
case "ATHLETEINJUREDTEXT":
fieldValue = "\"" + athleteEntry.InjuredText + "\"";
break;
case "ATHLETEMAXHR":
fieldValue = athleteEntry.MaximumHeartRatePerMinute.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETEMISSEDWORKOUT":
fieldValue = athleteEntry.MissedWorkout.ToString();
break;
case "ATHLETEMISSEDWORKOUTTEXT":
fieldValue = "\"" + athleteEntry.MissedWorkoutText + "\"";
break;
case "ATHLETEMOOD":
fieldValue = athleteEntry.Mood.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETERESTHR":
fieldValue = athleteEntry.RestingHeartRatePerMinute.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETESICK":
fieldValue = athleteEntry.Sick.ToString();
break;
case "ATHLETESICKTEXT":
fieldValue = "\"" + athleteEntry.SickText.Escape() + "\"";
break;
case "ATHLETESKINFOLD":
fieldValue = athleteEntry.Skinfold.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETESLEEPHOURS":
fieldValue = athleteEntry.SleepHours.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETESLEEPQUALITY":
fieldValue = "\"" + athleteEntry.SleepQuality.ToString(CultureInfo.InvariantCulture.NumberFormat) + "\"";
break;
case "ATHLETEWEIGHT":
fieldValue = athleteEntry.WeightKilograms.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETEHEIGHT":
fieldValue = CalculatedFields.GetLogBook().Athlete.HeightCentimeters.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
case "ATHLETESEX":
fieldValue = "\"" + CalculatedFields.GetLogBook().Athlete.Sex.ToString() + "\"";
break;
case "ATHLETEBIRTHDATE":
fieldValue = "\"" + CalculatedFields.GetLogBook().Athlete.DateOfBirth.ToShortDateString() + "\"";
break;
case "ATHLETEAGE":
DateTime now = activity.StartTime.ToUniversalTime() + activity.TimeZoneUtcOffset;
DateTime birth = CalculatedFields.GetLogBook().Athlete.DateOfBirth;
int years = now.Year - birth.Year;
if (now.Month < birth.Month || (now.Month == birth.Month && now.Day < birth.Day))
{
--years;
}
fieldValue = years.ToString(CultureInfo.InvariantCulture.NumberFormat);
break;
}
ICustomDataFieldObjectType type = CustomDataFieldDefinitions.StandardObjectType(typeof(IAthleteInfoEntry));
foreach (ICustomDataFieldDefinition definition in
CalculatedFields.GetLogBook().CustomDataFieldDefinitions)
{
if (definition.Name.ToUpper() == field && definition.ObjectType == type)
{
if (athleteEntry.GetCustomDataValue(definition) != null)
{
if (athleteEntry.GetCustomDataValue(definition) == null)
{
fieldValue = "null";
}
else
{
if (definition.DataType.Id == CustomDataFieldDefinitions.StandardDataTypes.NumberDataTypeId)
{
fieldValue = Double.Parse(athleteEntry.GetCustomDataValue(definition).ToString()).ToString(CultureInfo.InvariantCulture.NumberFormat);
}
else if (definition.DataType.Id == CustomDataFieldDefinitions.StandardDataTypes.TextDataTypeId)
{
fieldValue = athleteEntry.GetCustomDataValue(definition).ToString().Escape();
}
else if (definition.DataType.Id == CustomDataFieldDefinitions.StandardDataTypes.TimeSpanDataTypeId)
{
fieldValue = TimeSpan.Parse(activity.GetCustomDataValue(definition).ToString()).TotalSeconds.ToString(CultureInfo.InvariantCulture.NumberFormat);
}
}
}
}
}
return fieldValue;
}
示例4: GetCustomFieldsData
public void GetCustomFieldsData(IActivity activity,
out int? RPE,
out double? TE,
out int? Repetitions,
out int? Sets)
{
if (activity != null)
{
RPE = (int?)(activity.GetCustomDataValue(RPEField) as double?);
TE = activity.GetCustomDataValue(TEField) as double?;
Repetitions = (int?)(activity.GetCustomDataValue(RepetitionsField) as double?);
Sets = (int?)(activity.GetCustomDataValue(SetsField) as double?);
}
else
{
RPE = null;
TE = null;
Repetitions = null;
Sets = null;
}
}