Nate Bross
Contributor
I've got a collection of 'SearchResults' that I convert into an ArrayList of custom classes, because the collection has a large amount of data I do not care about.
Custom Class Deffinition
I get a new collection every few seconds (usually containing no new data), but every now and then there are new items in the collection. When this happens I want to notify the user and tell them what is new since last time.
Here's how I am figuring out if a new item has appeared.
What happens is that every item shows up in my UnViewed ArrayList.
I know there's alot of stuff here, but if you need more information let me know and I'll provide what I can.
Custom Class Deffinition
Visual Basic:
Public Class Item
Dim sTitle As String
Dim dPrice As Double
Dim dBuyIt As Double
Dim sItemID As String
Dim sURL As String
Dim dStartDate As Date
Public Sub New(ByVal sT As String, ByVal dP As Double, ByVal dB As Double, ByVal sID As String, ByVal URL As String, ByVal dSD As Date)
sTitle = sT
dPrice = dP
dBuyIt = dB
sItemID = sID
sURL = URL
dStartDate = dSD
End Sub
Public Property Title() As String
Get
Return sTitle
End Get
Set(ByVal value As String)
sTitle = value
End Set
End Property
Public Property Price() As Double
Get
Return dPrice
End Get
Set(ByVal value As Double)
dPrice = value
End Set
End Property
Public Property BuyItNowPrice() As Double
Get
Return dBuyIt
End Get
Set(ByVal value As Double)
dBuyIt = value
End Set
End Property
Public Property ItemID() As String
Get
Return sItemID
End Get
Set(ByVal value As String)
sItemID = value
End Set
End Property
Public Property URL() As String
Get
Return sURL
End Get
Set(ByVal value As String)
sURL = value
End Set
End Property
Public Property StartDate() As Date
Get
Return dStartDate
End Get
Set(ByVal value As Date)
dStartDate = value
End Set
End Property
End Class
I get a new collection every few seconds (usually containing no new data), but every now and then there are new items in the collection. When this happens I want to notify the user and tell them what is new since last time.
Here's how I am figuring out if a new item has appeared.
Visual Basic:
For Each result As SearchResultItemType In results
tbString.AppendLine(result.Item.ItemID & vbTab & result.Item.SellingStatus.CurrentPrice.Value() & vbTab & result.Item.ListingDetails.StartTime)
Dim tItem As New Item(result.Item.Title.ToString(), result.Item.SellingStatus.CurrentPrice.Value(), 0, result.Item.ItemID(), result.Item.ListingDetails.ViewItemURL.ToString(), result.Item.ListingDetails.StartTime())
'BuyItNowPrice returns nothing not 0 if no value is specified
If result.Item.BuyItNowPrice IsNot Nothing Then
tItem.BuyItNowPrice = result.Item.BuyItNowPrice.Value()
End If
If OldItems.IndexOf(tItem) > 0 Then
'The Item is In the Array
Dim x As Long = 0
Else
UnViewed.Add(tItem)
OldItems.Add(tItem)
End If
Next
What happens is that every item shows up in my UnViewed ArrayList.
I know there's alot of stuff here, but if you need more information let me know and I'll provide what I can.