Condividi tramite


Proprietà Macros.IsRecording

Restituisce se il registratore di macro sta registrando azioni.Questa proprietà non deve essere utilizzata dall'interno di una macro.

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

Sintassi

'Dichiarazione
ReadOnly Property IsRecording As Boolean
bool IsRecording { get; }
property bool IsRecording {
    bool get ();
}
abstract IsRecording : bool
function get IsRecording () : boolean

Valore proprietà

Tipo: System.Boolean
un valore booleano di true indica che il registratore di macro sta registrando azioni, false indica che non è.

Note

IsRecording deve essere utilizzato solo dall'interno di componenti aggiuntivi e non all'interno delle macro.

Esempi

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Macros Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

Automating Repetitive Actions by Using Macros