FeederAttribute.cs 1.1 KB

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using TeamAAS.Feeder.Enums;
  3. namespace TeamAAS.Feeder.Attributes
  4. {
  5. /// <summary>
  6. /// 供料器实现描述特性,用于反射发现。标记在实现 <see cref="Interfaces.IFeeder"/> 的类上。
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
  9. public class FeederAttribute : Attribute
  10. {
  11. public string DisplayName { get; }
  12. public FeederBrand Brand { get; }
  13. public string Description { get; set; } = "";
  14. /// <summary>
  15. /// 品牌专属调试页类型(必须是 <c>System.Windows.FrameworkElement</c> 的子类,且建议实现
  16. /// <c>TeamAAS.Feeder.UI.IFeederDebugPage</c> 以接收供料器实例)。
  17. /// 为 null(默认)时,宿主使用通用的手动调试面板。
  18. /// 用法:[Feeder("Afag 供料器", FeederBrand.Afag, DebugPageType = typeof(AfagFeederDebugPage))]
  19. /// </summary>
  20. public Type DebugPageType { get; set; }
  21. public FeederAttribute(string displayName, FeederBrand brand)
  22. {
  23. DisplayName = displayName;
  24. Brand = brand;
  25. }
  26. }
  27. }