Eventhandler does not keep working when changed layout

Eventhandler does not keep working when changed layout

erik_kohl
Contributor Contributor
321 Views
0 Replies
Message 1 of 1

Eventhandler does not keep working when changed layout

erik_kohl
Contributor
Contributor

Hi, This program (from autocad help) works fine until i changed to another layout. The addappevent and the removeappevent keeps working but the appsysvarchanged does not! Anyone knows how to solve this??

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Public Class Useri1Event
    <CommandMethod("AddAppEvent")> Public Sub AddAppEvent()
        AddHandler Application.SystemVariableChanged, AddressOf appSysVarChanged
    End Sub

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

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

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

        '' Display a message box with the system variable name and the new value
        Application.ShowAlertDialog(sysVarChEvtArgs.Name & " was changed." & vbLf & "New value: " & oVal.ToString())


        'End If

    End Sub

End Class

0 Likes
322 Views
0 Replies
Replies (0)