Metodo UndoContext.Close

termina un'operazione di annullamento.

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

Sintassi

'Dichiarazione
Sub Close
void Close()
void Close()
abstract Close : unit -> unit 
function Close()

Note

Se sono presenti riferimenti in corso a UndoContext oggetto, quindi Close interrompe l'operazione e genera un errore.Si verifica un errore se UndoContext l'oggetto non è aperto quando Close viene chiamato.

Esempi

Sub RemoveNewLines()
   ' Before running, select text in an open document.
   Dim txtSel As TextSelection
   Dim strTS As String, boolWasOpen As Boolean
   txtSel = DTE.ActiveDocument.Selection
   strTS = txtSel.Text

   ' Check to see if UndoContext object is already open.
   If DTE.UndoContext.IsOpen = True Then
      boolWasOpen = True
   Else
      ' Open the UndoContext object to track changes.
      DTE.UndoContext.Open("RemoveNewLines", False)
   End If

   ' Perform search for newline characters and remove them.
   If strTS <> "" Then
      txtSel.Delete()
      strTS = Replace(strTS, vbNewLine, "", Compare:=vbTextCompare)
      txtSel.Insert(strTS)
   End If

   ' If UndoContext was already open, don't close it.
   If boolWasOpen = False Then
      ' Close the UndoContext object to commit the changes.
      DTE.UndoContext.Close()
   End If
End Sub

Sicurezza di .NET Framework

Vedere anche

Riferimenti

UndoContext Interfaccia

Spazio dei nomi EnvDTE