- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to handle the EndSave event (.net vb)?
I don't understand this:
Also I don't get it if it is a DocumentEvent or DocumentCollectionEvent.
Like what is the correct name of the event? I can't find it. And what name should the procedure have?
Here is my code for an AutoCAD plugin which already registers when the user closes AutoCAD. I want it to register the EndSave as well, but I don't know how to do it. I've also attached an image to the code in visual studio.
Thanks in advance.
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
Solved! Go to Solution.