如何处理 EndSave 事件 (AutoCAD .net vb)?

How to handle the EndSave event (AutoCAD .net vb)?

如何处理 EndSave 事件 (.net vb)?

我不明白这个:

AutoCAD Dev's guide

如果它是 DocumentEvent 或 DocumentCollectionEvent,我也不明白。

比如活动的正确名称是什么?我找不到它。程序应该起什么名字?

这是我的 AutoCAD 插件代码,该插件在用户关闭 AutoCAD 时已经注册。我也想让它注册EndSave,但我不知道该怎么做。

提前致谢。

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Excel = Microsoft.Office.Interop.Excel
Imports System.IO



Public Class Class1


<CommandMethod("AddAppEvent")>
Public Sub AddAppEvent()
AddHandler Application.DocumentManager.DocumentActivated, AddressOf AcadDocument_EndSave
AddHandler Application.SystemVariableChanged, AddressOf appSysVarChanged 'adicionado para o save
End Sub



<CommandMethod("RemoveAppEvent")>
Public Sub RemoveAppEvent()
RemoveHandler Application.SystemVariableChanged, AddressOf appSysVarChanged
End Sub



Public Sub AcadDocument_EndSave(ByVal DocumentCollection As Autodesk.AutoCAD.ApplicationServices. 
DocumentCollectionEventArgs)



Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("C:\Users\rita.aguiar\Documents\AutoCAD plug-in\Registo de Eventos.txt", True)
file.WriteLine("O documento foi guardado.")
file.Close()

End Sub



Public Sub appSysVarChanged(ByVal senderObj As Object,
ByVal sysVarChEvtArgs As Autodesk.AutoCAD.ApplicationServices.
SystemVariableChangedEventArgs)

Dim oVal As Object = Application.GetSystemVariable(sysVarChEvtArgs.Name)

Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("C:\Users\rita.aguiar\Documents\AutoCAD plug-in\Registo de Eventos.txt", True)
file.WriteLine("O AutoCAD foi encerrado.")
file.Close()

End Sub



End Class

没有 EndSave 事件。 我决定改用 EndCommand 事件,并在用户完成 SAVE、SAVEAS 和 QSAVE 命令时注册。