protected override string GetDisplayText() { // this override is needed so that the initialization will display the correct text // and we have to wait until this is hit after all the Owner and ItemName have been set // since this.Item is never set for this control, since it cannot be for a raw type like enum. ModelProperty modelProperty = GetModelProperty(); if (null != modelProperty) { // Try get display text via NaturalLanguageHelper ActivityTranslator translator = EditingContext.Services.GetService <ActivityTranslator>(); string displayText = translator.Translate(modelProperty.Value); if (displayText == null) { return(GetEnumTextDisplay(modelProperty.ComputedValue)); } else { return(displayText); } } else { return(String.Empty); } }
private static string DynamicLiteralValueTranslateItem(ActivityTranslator translator, ModelItem item) { object value = item.Properties[IMConstants.ValuePropertyName].Value.GetCurrentValue(); DynamicValue validValue = GetValidValue(item, new DynamicValue(value)); if (null != validValue.Value) { return(validValue.ToString()); } return(value.ToString()); }
private static string LiteralValueTranslateItem(ActivityTranslator translator, ModelItem item) { var temp = item.GetCurrentValue() as sae.Literal <DynamicValue>; if (null != temp) { DynamicValue id = temp.Value; DynamicValue validValue = GetValidValue(item, id); if (null != validValue.Value) { return(validValue.ToString()); } } return(translator.Translate(item.Properties[IMConstants.ValuePropertyName].Value)); }
/// <summary> /// Add AUD-specific translation items to given translator. /// </summary> /// <param name="translator">The given ActivityTranslator object representing a translator.</param> public static void AddActivityTranslateItems(ActivityTranslator translator) { translator.AddTranslateItem(typeof(sae.Literal <>), LiteralValueTranslateItem); translator.AddTranslateItem(typeof(DynamicLiteral <>), DynamicLiteralValueTranslateItem); translator.AddTranslateItem(typeof(DynamicStringLiteral), DynamicLiteralValueTranslateItem); }