RobotAttribute.cs 1.0 KB

12345678910111213141516171819202122232425262728
  1. using System;
  2. using TeamAAS.Robot.Enums;
  3. namespace TeamAAS.Robot.Attributes
  4. {
  5. [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
  6. public sealed class RobotAttribute : Attribute
  7. {
  8. public string DisplayName { get; }
  9. public RobotBrand Brand { get; }
  10. public string Description { get; }
  11. /// <summary>
  12. /// 品牌专属调试页类型(必须是 <c>System.Windows.FrameworkElement</c> 的子类,且建议实现
  13. /// <c>TeamAAS.Robot.UI.IRobotDebugPage</c> 以接收机器人实例)。
  14. /// 为 null(默认)时,宿主使用通用的手动调试面板。
  15. /// 用法:[Robot("EPSON", RobotBrand.EPSON, DebugPageType = typeof(EpsonDebugPage))]
  16. /// </summary>
  17. public Type DebugPageType { get; set; }
  18. public RobotAttribute(string displayName, RobotBrand brand, string description = "")
  19. {
  20. DisplayName = displayName;
  21. Brand = brand;
  22. Description = description;
  23. }
  24. }
  25. }