Share via


UndoContext.IsAborted 속성

SetAborted 메서드에 의해 UndoContext 개체 작업이 종료되었는지 여부를 가져옵니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
ReadOnly Property IsAborted As Boolean
bool IsAborted { get; }
property bool IsAborted {
    bool get ();
}
abstract IsAborted : bool with get
function get IsAborted () : boolean

속성 값

형식: Boolean
작업이 중단되었으면 true를 나타내고 그렇지 않으면 false를 나타내는 부울 값입니다.

설명

UndoContext 개체를 닫기 전에 SetAborted에 의해 개체를 사용할 수 없게 되면 UndoContext 개체를 닫을 때 관련 문서의 모든 변경 내용이 취소됩니다.

예제

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

.NET Framework 보안

참고 항목

참조

UndoContext 인터페이스

EnvDTE 네임스페이스