using System;
namespace RevitGen.Attributes
{
///
/// 将一个类标记为Revit外部命令,并自动为其生成UI按钮和必要的接口实现。
///
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class RevitCommandAttribute : Attribute
{
///
/// 按钮上显示的文本。
///
public string Text { get; }
///
/// 按钮所在的Ribbon Tab的名称。
///
public string TabName { get; set; } = "RevitGen";
///
/// 按钮所在的Ribbon Panel的名称。
///
public string PanelName { get; set; } = "Commands";
///
/// 图标
///
public string Icon { get; set; } = "";
///
/// 鼠标悬停在按钮上时显示的工具提示。
///
public string ToolTip { get; set; } = "";
///
/// 构造函数
///
/// 按钮上显示的文本。
public RevitCommandAttribute(string text)
{
if (string.IsNullOrWhiteSpace(text))
{
throw new ArgumentNullException(nameof(text), "Command button text cannot be empty.");
}
Text = text;
}
public bool UsingTransaction { get; set; }
}
}