Macros.IsRecording Property
Returns whether the macro recorder is currently recording actions. This property should not be used from within a macro.
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 with get
function get IsRecording () : boolean
Property Value
Type: System.Boolean
A Boolean value of true indicates that the macro recorder is currently recording actions; false indicates that it is not.
Remarks
IsRecording should be used only from within add-ins and not within macros.
Examples
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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.