Macros.Resume 方法
如果宏记录已暂停,则继续宏记录。 此方法不应从宏内部使用。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
Sub Resume
void Resume()
void Resume()
abstract Resume : unit -> unit
function Resume()
备注
若要暂停录制宏,请使用 Pause。 如果未暂停录制宏,则 Resume 会失败。
Resume 只能从外接程序内部使用。
如果在外接程序中但不是在宏记录模式下调用 Resume,则此方法不起作用,并且会出现一条消息“错误”。
示例
public void CodeExample(DTE2 dte, AddIn addin)
{
// INSTRUCTIONS: Run this code, open a solution, start
// recording a macro, then connect the add-in 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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。