<Display(Name:="Line")>
Public Property Line() As String
Get
Return DirectCast(GetValue("Line"), String)
End Get
Set
SetValue("Line", Value)
End Set
End Property
<Display(Name:="Color")>
Public Property Color() As String
Get
Return DirectCast(GetValue("Color"), String)
End Get
Set
SetValue("Color", Value)
End Set
End Property
<Display(Name:="Name")>
Public Property Name() As String
Get
Return DirectCast(GetValue("Name"), String)
End Get
Set
SetValue("Name", Value)
End Set
End Property
<Display(Name:="Price")>
Public Property Price() As Double
Get
Return CDbl(GetValue("Price"))
End Get
Set
SetValue("Price", Value)
End Set
End Property
<Display(Name:="Weight")>
Public Property Weight() As Double
Get
Return CDbl(GetValue("Weight"))
End Get
Set
SetValue("Weight", Value)
End Set
End Property
<Display(Name:="Cost")>
Public Property Cost() As Double
Get
Return CDbl(GetValue("Cost"))
End Get
Set
SetValue("Cost", Value)
End Set
End Property
<Display(Name:="Volume")>
Public Property Volume() As Double
Get
Return CDbl(GetValue("Volume"))
End Get
Set
SetValue("Volume", Value)
End Set
End Property
<Display(Name:="Discontinued")>
Public Property Discontinued() As Boolean
Get
Return CBool(GetValue("Discontinued"))
End Get
Set
SetValue("Discontinued", Value)
End Set
End Property
<Display(Name:="Rating")>
Public Property Rating() As Integer
Get
Return CInt(GetValue("Rating"))
End Get
Set
SetValue("Rating", Value)
End Set
End Property
' get/set values
Private values As New Dictionary(Of String, Object)()
Private Function GetValue(p As String) As Object
Dim value As Object
values.TryGetValue(p, value)
Return value
End Function
Private Sub SetValue(p As String, value As Object)
If Not Object.Equals(value, GetValue(p)) Then
values(p) = value
OnPropertyChanged(p)
End If
End Sub
Protected Overridable Sub OnPropertyChanged(p As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(p))
End Sub
Public Shared Function GetLines() As String()
Return lines
End Function
#Region "INotifyPropertyChanged Members"
Public Event PropertyChanged As PropertyChangedEventHandler _
Implements INotifyPropertyChanged.PropertyChanged