Proprietà UndoContext.IsAborted
Indica se UndoContext l'operazione dell'oggetto è stata interrotta da SetAborted metodo.
Spazio dei nomi: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Sintassi
'Dichiarazione
ReadOnly Property IsAborted As Boolean
bool IsAborted { get; }
property bool IsAborted {
bool get ();
}
abstract IsAborted : bool
function get IsAborted () : boolean
Valore proprietà
Tipo: System.Boolean
Indicazione di valore booleanotrue se l'operazione è stata interrotta, false in caso contrario.
Note
se UndoContext l'oggetto è disabilitato da SetAborted prima di essere chiuso, tutte le modifiche apportate ai documenti partecipanti verranno rimosse quando UndoContext l'oggetto viene chiuso.
Esempi
Sub IsAbortedExample()
' Before running, select text in an open document.
Dim txtSel As TextSelection
Dim strTS As String, strAnswer As String, bIsOpen As Boolean
txtSel = DTE.ActiveDocument.Selection
strTS = txtSel.Text
' Check to see if UndoContext object is already open.
If DTE.UndoContext.IsOpen = True Then
bIsOpen = True
Else
' Open the UndoContext object to track changes.
DTE.UndoContext.Open("RemoveNewLines", False)
End If
MsgBox("Current IsAborted value: " & DTE.UndoContext.IsAborted)
' Perform search for newline characters and remove them.
If strTS <> "" Then
txtSel.Delete()
strTS = Replace(strTS, vbNewLine, "", Compare:=vbTextCompare)
txtSel.Insert(strTS)
End If
' Check to see if you want to discard changes.
strAnswer = MsgBox("Do you want to discard all changes made?", vbYesNo & vbQuestion)
If strAnswer = True Then
DTE.UndoContext.SetAborted()
MsgBox("Current IsAborted value: " & DTE.UndoContext.IsAborted)
End If
' If UndoContext was already open, don't close it.
If bIsOpen = True Then
' Close the UndoContext object to commit the changes.
DTE.UndoContext.Close()
End If
End Sub
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per ulteriori informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.