Freigeben über


Macros.IsRecording-Eigenschaft

Gibt an, ob die Makroaufzeichnung derzeit Aktionen aufzeichnet.Diese Eigenschaft sollte nicht innerhalb eines Makros verwendet werden.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

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

Eigenschaftswert

Typ: System.Boolean
Der boolesche Wert true gibt an, dass die Makroaufzeichnung derzeit Aktionen aufzeichnet. Bei false findet keine Aufzeichnung statt.

Hinweise

IsRecording sollte nur in Add-Ins und nicht in Makros verwendet werden.

Beispiele

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

.NET Framework-Sicherheit

Siehe auch

Referenz

Macros Schnittstelle

EnvDTE-Namespace

Weitere Ressourcen

Automating Repetitive Actions by Using Macros