Imports System.ComponentModel

Namespace Data

    ''' <summary>
    ''' A base class for collection members that can send change notifications.
    ''' </summary>
    ''' <remarks></remarks>
    Public MustInherit Class NotifyMemberBase
        Implements INotifyPropertyChanged

        ''' <summary>
        ''' Initializes a default instance of the NotifyMemberBase class.
        ''' </summary>
        ''' <remarks></remarks>
        Protected Sub New()
        End Sub

        ''' <summary>
        ''' Gets a value indicating whether the property changed event handler has been attached to.
        ''' </summary>
        ''' <returns>True if the property changed event handler has been attached to; otherwise, false.</returns>
        ''' <remarks></remarks>
        Protected ReadOnly Property IsPropertyChangedEventAttached() As Boolean
            Get
                Return (Me.PropertyChangedEvent IsNot Nothing)
            End Get
        End Property

        ''' <summary>
        ''' Thrown when a property value has been changed.
        ''' </summary>
        Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

        ''' <summary>
        ''' Raises the property changed event.
        ''' </summary>
        ''' <param name="propertyName">The name of the property that was changed.</param>
        ''' <remarks></remarks>
        Protected Overridable Sub OnPropertyChanged(ByVal propertyName As String)
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
        End Sub

    End Class

End Namespace