Originally posted by randman
View Post
Class AlertDevice
...
Private Shared _hs As HomeSeerAPI.IHSApplication
...
' Important: AssignHs Shared Sub must be called before creating instances of this class.
Public Shared Sub AssignHs(hs As HomeSeerAPI.IHSApplication)
_hs = hs
End Sub
... Use _hs.WriteLog, etc. ...
End Class
Then, from Main, I had to:
Public Sub Main(ByVal param As Object)
...
AlertDevice.AssignHs(hs)
...
End Sub
So, it's important that AlertDevice.AssignHs(hs) is called before any instances of the AlertDevice class are created.
Is there a more elegant way to do this?
Thanks.
Comment