Localization.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:LocalizedDescriptionAttribute.cs
  5. * 2.功能描述:类文件
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2014/09/01 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.ComponentModel;
  12. namespace Dongke.IBOSS.PRD.Basics.DockPanel
  13. {
  14. [AttributeUsage(AttributeTargets.All)]
  15. internal sealed class LocalizedDescriptionAttribute : DescriptionAttribute
  16. {
  17. private bool m_initialized = false;
  18. public LocalizedDescriptionAttribute(string key)
  19. : base(key)
  20. {
  21. }
  22. public override string Description
  23. {
  24. get
  25. {
  26. if (!m_initialized)
  27. {
  28. string key = base.Description;
  29. DescriptionValue = ResourceHelper.GetString(key);
  30. if (DescriptionValue == null)
  31. DescriptionValue = String.Empty;
  32. m_initialized = true;
  33. }
  34. return DescriptionValue;
  35. }
  36. }
  37. }
  38. [AttributeUsage(AttributeTargets.All)]
  39. internal sealed class LocalizedCategoryAttribute : CategoryAttribute
  40. {
  41. public LocalizedCategoryAttribute(string key)
  42. : base(key)
  43. {
  44. }
  45. protected override string GetLocalizedString(string key)
  46. {
  47. return ResourceHelper.GetString(key);
  48. }
  49. }
  50. }