21 lines
860 B
C#
21 lines
860 B
C#
|
|
using System.ComponentModel;
|
|||
|
|
|
|||
|
|
namespace DTS.Common.Base.Classes
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// this class overloads the description attribute to allow us to use an enum
|
|||
|
|
/// to set the description and to lookup the description in the string resources
|
|||
|
|
/// to be translated the property should have a string resource in the form of PropertyName_Description
|
|||
|
|
/// otherwise ##DescriptionNotFound## will be returned as the translated string
|
|||
|
|
/// </summary>
|
|||
|
|
public class DisplayResourceAttribute : DisplayNameAttribute
|
|||
|
|
{
|
|||
|
|
private string _resourceId;
|
|||
|
|
public DisplayResourceAttribute(string resourceId)
|
|||
|
|
{
|
|||
|
|
_resourceId = resourceId;
|
|||
|
|
}
|
|||
|
|
public override string DisplayName => Strings.Strings.ResourceManager.GetString(_resourceId) ?? @"##ResourceNotFound##" + _resourceId;
|
|||
|
|
}
|
|||
|
|
}
|