Condividi tramite


Metodo Macros.Resume

Riprende la registrazione se è stata sospesa.Questo metodo non deve essere utilizzato 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 registrazione di macro, utilizzare Pause.Resume ha esito negativo se la registrazione di macro non è stata sospesa.

Resume deve essere utilizzato solo da componenti aggiuntivi.

Se si richiama Resume in un componente aggiuntivo mentre non nella macro modalità di registrazione, il metodo non effettua alcuna operazione e “un messaggio di errore non specificato„ si verifica.

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

Automating Repetitive Actions by Using Macros