Condividi tramite


Metodo Macros.Resume

Ripristina la registrazione macro se è stata sospesa. Il metodo non è utilizzabile dall'interno di una macro.

Spazio dei nomi:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Sintassi

'Dichiarazione
Sub Resume
void Resume()
void Resume()
abstract Resume : unit -> unit 
function Resume()

Note

Per sospendere la registrazione macro, utilizzare il metodo Pause. Resume non riesce se la registrazione macro non è stata sospesa.

Il metodo Resume deve essere utilizzato solo dall'interno di componenti aggiuntivi.

Se si richiama Resume da un componente aggiuntivo mentre non è attiva la modalità di registrazione macro, il metodo non esegue alcuna operazione e viene generato il messaggio "Errore non specificato".

Esempi

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);
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Macros Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

Automazione di operazioni ripetitive tramite macro