Macros.IsRecording 属性
返回宏记录器当前是否正在记录操作。 此属性不应从宏内部使用。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
ReadOnly Property IsRecording As Boolean
Get
bool IsRecording { get; }
property bool IsRecording {
bool get ();
}
abstract IsRecording : bool
function get IsRecording () : boolean
属性值
类型:System.Boolean
布尔值 true 指示宏记录器当前正在记录操作;false 指示当前没有记录操作。
备注
IsRecording 只能从外接程序内部使用,而不能从宏内部使用。
示例
public void CodeExample(DTE2 dte, AddIn addin)
{
// INSTRUCTIONS: Run this code, open a solution, start
// recording a macro, then connect the addin containing this code.
try
{
Macros mac = dte.Macros;
if (mac.IsRecording)
{
mac.Pause();
if (!mac.IsRecording)
mac.Resume();
mac.EmitMacroCode("rem Code added by the EmitMacroCode method");
// Demonstrate these two properties return the same reference.
bool test = mac.DTE.Equals(mac.Parent);
if (test) MessageBox.Show("The DTE and Parent property refer to the same object.");
else MessageBox.Show("The DTE and Parent property do not refer to the same object.");
}
else MessageBox.Show("Start a macro recording session and reconnect addin");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。