.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use event "SystemVariableChanged" ?

1 REPLY 1
Reply
Message 1 of 2
mario.rosenbohm
464 Views, 1 Reply

How to use event "SystemVariableChanged" ?


Hello,



I want the system variable "OSNAP" monitor. I have seen that the

"Autodesk.AutoCAD.ApplicationServices.Application" a

shared public event "SystemVariableChanged" has.

Can I use these for?



my idea is so far:

{font:courier new}{size:12px}



Public Class KSRO_ChangeOSNAP_ExtApp Implements Autodesk.AutoCAD.Runtime.IExtensionApplication



Private pAcadApp As Autodesk.AutoCAD.ApplicationServices.Application

Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize

pAcadApp = Application.AcadApplication

AddHandler pAcadApp.SystemVariableChanged, New SystemVariableChangedEventHandler(AddressOf pAcadApp_SysVarChanged)

End Sub



Public Sub pAcadApp_SysVarChanged(ByVal sender As Object, ByVal e As SystemVariableChangedEventArgs)

If (e.Name.ToUpper = "OSNAP") Then KSRO_ChangeOSNAP_Commands.SetAllButtonsToStat()

End Sub

End Class



{size}{font}




{font:Courier New}is this possible?



greets

Mario{font}
1 REPLY 1
Message 2 of 2

Hello,
i have found a solution (ist work for me):

{code}
Public Class KSROClass_ExtApp
Implements IExtensionApplication
Dim OSMODE_Handler As [Delegate]
Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize
OSMODE_Handler = New SystemVariableChangedEventHandler(AddressOf pAcadApp_SysVarChanged)
AddHandler Autodesk.AutoCAD.ApplicationServices.Application.SystemVariableChanged, OSMODE_Handler
End Sub


Public Sub pAcadApp_SysVarChanged(ByVal sender As Object, ByVal e As SystemVariableChangedEventArgs)
If (e.Name.ToUpper = "OSMODE") Then
MsgBox(e.Name.ToUpper)
End If
End Sub

Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate
RemoveHandler Autodesk.AutoCAD.ApplicationServices.Application.SystemVariableChanged, OSMODE_Handler

End Sub
End Class
{code}

greets Mario

PS: the texteditor for this forum has a betastate or?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost