Private networkAvailableEventHandler As NetworkAvailableEventHandler = AddressOf NetworkConnectionChanged
Private Sub NetworkConnectionChanged(sender As Object, e As NetworkAvailableEventArgs)
If Not disposed Then
OnPropertyChanged("IsNetworkAvailable")
End If
End Sub
Dim disposed As Boolean = False
Public Overloads Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
MyBase.Dispose()
GC.SuppressFinalize(Me)
End Sub
Protected Overridable Overloads Sub Dispose(disposing As Boolean)
If disposed = False Then
If disposing Then
RemoveHandler My.Computer.Network.NetworkAvailabilityChanged, networkAvailableEventHandler
networkAvailableEventHandler = Nothing
disposed = True
End If
End If
End Sub
Protected Overrides Sub Finalize()
Dispose(False)
End Sub
I have something close to above, my problem is, even after disposing the whole object the EventHandler invoke the NetworkConnectionChanged method even after removing the address.
any clues?