Share via


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 安全性

請參閱

參考

Macros 介面

EnvDTE 命名空間

其他資源

使用巨集自動執行重複的動作