Сначала вы должны удалить импорт:
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports System.Windows
1) обработать событие DocumentLockModeChanged
, например:
Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize
Try
subHandler = New DocumentLockModeChangedEventHandler(AddressOf docChange)
AddHandler Application.DocumentManager.DocumentLockModeChanged, subHandler
Catch ex As Exception
Err.Clear()
End Try
End Sub
2) и затем проверьте, является ли command
SAVE или SAVEAS :
Implements Autodesk.AutoCAD.Runtime.IExtensionApplication
Dim subHandler As [Delegate]
Public Sub docChange(ByVal sender As Object, ByVal e As DocumentLockModeChangedEventArgs)
If e.GlobalCommandName = "QSAVE" Or e.GlobalCommandName = "SAVE" Or e.GlobalCommandName = "SAVEAS" Then
Application.ShowAlertDialog("Save has occurred")
End If
End Sub
На данный момент, если хотите, вы можете добавить дескриптордля события terminate , например:
Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate
RemoveHandler Application.DocumentManager.DocumentLockModeChanged, subHandler
End Sub