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

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

rita.aguiar
Advocate Advocate
572 Views
1 Reply
Message 1 of 2

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

rita.aguiar
Advocate
Advocate

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

I don't understand this:

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a919382...

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

0 Likes
Accepted solutions (1)
573 Views
1 Reply
Reply (1)
Message 2 of 2

rita.aguiar
Advocate
Advocate
Accepted solution

There is no EndSave Event. I have to create it if I want to use it.

0 Likes