Subscribe to In the Life of....        RSS Feed
-----

Woot Tracker - Project Competed

Icon 3 Comments
Alright, I have finished the Woot Tracker Project. :)

I want to thank those individuals who suggested some names for my application. I finally settled on the release name for the project, it will now be referred to as Woot Watcher.

I opted not to include a setting to run when Windows starts. I will leave that up to those users that want it to run at start-up to just create a shortcut in the StartUp folder which is found in the All Programs on the Start menu.

The only real requirement is that it requires the .NET Framework be installed. If you don't have it installed, then the installation program will detect its absence and will prompt you to download it from Microsofts website.

The download can be found at the following link.
Click here to download Woot Watcher.

I have set-up an email address so that any bugs or problems can be reported to me and I will fix them as I can. In addition, feel free to email me with any suggestions for ways that it can be improved or additional features you think might be beneficial.

You can email any bugs or issues to WootWatcher at Comcast.net.

I have also included a ReadMe text file with the installer, which provides instructions for Installing/Uninstalling the application. Along with some general information including the email address.

I hope you find it as useful as I do. Enjoy!

3 Comments On This Entry

Page 1 of 1

Jayman Icon

01 May 2007 - 01:55 PM
hotsnoj has requested the source code. So here it is.
Imports System.Xml

Public Class WootWatcher

	'create a constant string for the Woot Home Page
	Const wootLink As String = "http://www.woot.com/salerss.aspx"
	Const wootHome As String = "http://www.woot.com"
	Private purchaseLink As String
	Private subTitleCheck As String = ""
	Private sameItem As Boolean
	Dim wootOff As Boolean


#Region "XMLReader"
	Private Sub LoadXmlDocument()
		'There are two description tags, need to bypass the first one
		'to get to the one with the product description
		Dim passFirstDesc, gotTitle As Boolean
		'Dim gotSubtitle As Boolean
		Dim subtitle As String = ""
		Dim description As String = ""
		Dim percentSold As Double

		Dim settings As New XmlReaderSettings()
		settings.ConformanceLevel = ConformanceLevel.Fragment
		settings.IgnoreWhitespace = True
		settings.IgnoreComments = True

		Try
			Dim reader As XmlReader = XmlReader.Create(wootLink, settings)

			Do While reader.Read
				Select Case reader.NodeType
					Case XmlNodeType.Element
						Select Case reader.Name
							Case "title"
								If Not gotTitle Then
									Me.lblSaleItemTitle.Text = reader.ReadString
									gotTitle = True
								End If

							Case "woot:price"
								Me.lblItemPrice.Text = reader.ReadString

							Case "woot:standardimage"
								'If this is the same items already being displayed
								'don't download the picture again
								If Not sameItem Then
									Dim image As New System.Net.WebClient
									image.DownloadFile(reader.ReadString, Application.StartupPath & "\tempImage.jpg")
									'Load image into Bitmap
									Dim imgSource As Bitmap = New Bitmap(Application.StartupPath & "\tempImage.jpg")
									'Create Bitmap to store resized image
									Dim itemPicture As Bitmap = New Bitmap(300, 227)
									Dim grImage As Graphics = Graphics.FromImage(itemPicture)
									'Resize image to fit into PictureBox
									grImage.DrawImage(imgSource, 0, 0, itemPicture.Width + 1, itemPicture.Height + 1)
									Me.picSaleItemPicture.Image = itemPicture
								End If

							Case "woot:purchaseurl"
								purchaseLink = reader.ReadString

							Case "woot:soldoutpercentage"
								percentSold = CDbl(reader.ReadString)
								Me.pbarSoldPercentage.Value = CInt((1 - percentSold) * 100)
								Me.lblPercentRemaining.Text = Me.pbarSoldPercentage.Value & "% Remaining"

							Case "woot:wootoff"
								wootOff = CBool(reader.ReadString)
								'Check if there is a Woot Off in progress
								'IF True then start Woot Off timer, othewise
								'start the regular timer.
								If wootOff Then
									Me.lblWootOffMessage.Text = "Woot-Off in Progress!"
									Me.lblPercentRemaining.Visible = True
									Me.pbarSoldPercentage.Visible = True
									Me.tmrNoWootRefresh.Stop()
									Me.tmrRefresh.Start()
									Me.tbrRefreshRate.Enabled = True
									'set the refresh slider to equal the current timer interval
									Me.tbrRefreshRate.Value = CInt(CInt(Me.tmrRefresh.Interval) / 1000)
								Else
									Me.lblWootOffMessage.Text = "There is not a Woot-Off today!"
									Me.lblPercentRemaining.Visible = False
									Me.pbarSoldPercentage.Visible = False
									Me.tmrNoWootRefresh.Start()
									Me.tmrRefresh.Stop()
									Me.tbrRefreshRate.Enabled = False
									Me.lblRefreshRate.Text = "2 Minutes"
								End If

							Case "woot:condition"
								Me.lblProductCondition.Text = "Condition: " & reader.ReadString

							Case "woot:soldout"
								If CBool(reader.ReadString) Then
									Me.lnklblBuyNow.Visible = False
									Me.lblSoldOut.Visible = True
									Me.pbarSoldPercentage.Value = 0
									Me.lblPercentRemaining.Text = "0% Remaining"

								Else
									Me.lnklblBuyNow.Visible = True
									Me.lblSoldOut.Visible = False
								End If

							Case "woot:subtitle"
								subtitle = reader.ReadString
								'Check if this is same as the current item
								'If it's the same item then set sameItem to True
								If subTitleCheck = subtitle Then
									sameItem = True
								Else
									subTitleCheck = subtitle
									sameItem = False
								End If

							Case "description"
								If passFirstDesc Then
									description = reader.ReadString
									passFirstDesc = False
								Else
									passFirstDesc = True
								End If

							Case Else
								'handles everything else that isn't needed
						End Select

					Case Else
						'handles everything else that isn't needed
				End Select
			Loop

			reader.Close()
		Catch ex As Exception
			'Caught an error trying to update data
			'leave the procedure to avoid crashing the program
			Exit Sub
		End Try

		'update the text display when the mouse hovers 
		'over the system tray icon
		UpdateMouseHoverTip()

		If Not sameItem Then
			'Load the description in the mini browser
			LoadDescritionToDisplay(subtitle, description)
			If Me.cbxNewItemAlert.Checked Then
				My.Computer.Audio.Play(Application.StartupPath & "\Sounds\alert.wav")
			End If
			'If form is minimized then display a balloon tip
			If Me.WindowState = FormWindowState.Minimized Then
				DisplayBalloonTip()
			End If
		End If

		'Check and see if product is a match for the search strings
		'if it is, then sound an alert.
		If SoundAlertCheck() And Me.cbxSearchAlert.Checked Then
			PlayAlert()
		End If
	End Sub
#End Region

#Region "Form Events"

	Private Sub btnAddSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddSearch.Click

		If Me.txtSearchTerm.Text = String.Empty Then
			MessageBox.Show("You must enter a value to add to list", "Input Error", _
				MessageBoxButtons.OK, MessageBoxIcon.Error)
			Me.txtSearchTerm.Focus()
			Exit Sub
		Else
			Me.lstSearchStrings.Items.Add(Me.txtSearchTerm.Text)
			Me.txtSearchTerm.Text = ""
			'Save all the options and search parameters before exiting
			SaveData()
		End If
	End Sub

	Private Sub WootTracker_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
		'Save the current settings
		My.Settings.NewItemCheckBox = CStr(Me.cbxNewItemAlert.Checked)
		My.Settings.SearchAlertCheckbox = CStr(Me.cbxSearchAlert.Checked)
	End Sub

	Private Sub WootTracker_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		'Load My.Settings
		Me.cbxNewItemAlert.Checked = CBool(My.Settings.NewItemCheckBox)
		Me.cbxSearchAlert.Checked = CBool(My.Settings.SearchAlertCheckbox)
		'create system tray icon
		Me.ntfySystemTray.Icon = New Icon(Application.StartupPath & "\images\owl.ico")
		'hide the notify icon until the form is minimized
		Me.ntfySystemTray.Visible = False
		'load data from previous session
		LoadSavedData()
		LoadXmlDocument()
		'Load the default page in the browser
		browserUrl = wootHome
		Navigate()
		'set the refresh slider to equal the current timer interval
		Me.tbrRefreshRate.Value = CInt(CInt(Me.tmrRefresh.Interval) / 1000)
	End Sub

	Private Sub lnklblBuyNow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnklblBuyNow.Click
		'Give focus to Browser tab
		Me.TabControl1.SelectedTab = Me.TabPage3
		'Set browser to Buy One Link
		browserUrl = purchaseLink
		Navigate()
	End Sub

	Private Sub btnDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteItem.Click
		If Me.lstSearchStrings.SelectedItem Is Nothing Then
			MessageBox.Show("You must select an item in the list to remove it.", "Deletion Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
		Else
			Me.lstSearchStrings.Items.RemoveAt(Me.lstSearchStrings.SelectedIndex)
			'Save all the options and search parameters before exiting
			SaveData()
		End If
	End Sub

	Private Sub lstSearchStrings_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstSearchStrings.DoubleClick
		If Not Me.lstSearchStrings.SelectedItem Is Nothing Then
			Me.lstSearchStrings.Items.RemoveAt(Me.lstSearchStrings.SelectedIndex)
			'Save all the options and search parameters before exiting
			SaveData()
		End If
	End Sub

	Private Sub tbrRefreshRate_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbrRefreshRate.ValueChanged
		Dim value As Integer = Me.tbrRefreshRate.Value

		'stop the refresh timer, reset to new refresh rate, then restart timer
		Me.tmrRefresh.Stop()
		Me.tmrRefresh.Interval = value * 1000
		Me.tmrRefresh.Start()

		'Now reset the value in the refresh label
		Me.lblRefreshRate.Text = value & " seconds"

	End Sub

	Private Sub btnStopAlert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStopAlert.Click
		Me.tmrAlert.Stop()
	End Sub

	Private Sub WootTracker_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move

		'if form is minimized then hide applicaton so it doesn't show up in tray
		If Me.WindowState = FormWindowState.Minimized Then
			'show the notify icon
			Me.ntfySystemTray.Visible = True
			Me.Hide()
			DisplayBalloonTip()
		Else
			'show the notify icon
			Me.ntfySystemTray.Visible = False
			Me.Show()
		End If
	End Sub

	Private Sub ntfySystemTray_BalloonTipClicked(ByVal sender As Object, ByVal e As System.EventArgs) Handles ntfySystemTray.BalloonTipClicked
		Me.Show()
		Me.WindowState = FormWindowState.Normal
		Me.ntfySystemTray.Visible = False
		Me.Activate()
	End Sub

	Private Sub ntfySystemTray_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ntfySystemTray.DoubleClick
		'unhide form and set window state to Normal
		If Me.WindowState = FormWindowState.Minimized Then
			Me.Show()
			Me.WindowState = FormWindowState.Normal
			Me.Activate()
			Me.ntfySystemTray.Visible = False
		End If
	End Sub

#End Region

#Region "Functions & Procedures"

	Private Sub LoadSavedData()
		Dim dataStreamReader As IO.StreamReader

		'check if the file exists
		If IO.File.Exists("Config Settings.txt") Then
			dataStreamReader = IO.File.OpenText("Config Settings.txt")

			Do Until dataStreamReader.Peek = -1
				'read a line from the file and add it to the search list
				Me.lstSearchStrings.Items.Add(dataStreamReader.ReadLine)
			Loop
			'close the file
			dataStreamReader.Close()
		End If
	End Sub

	Private Sub SaveData()
		Dim dataStreamWriter As IO.StreamWriter
		Dim x As Integer

		dataStreamWriter = IO.File.CreateText("Config Settings.txt")

		For x = 0 To Me.lstSearchStrings.Items.Count - 1
			dataStreamWriter.WriteLine(Me.lstSearchStrings.Items(x).ToString)
		Next x
		'close the file
		dataStreamWriter.Close()
	End Sub

	Private Sub LoadDescritionToDisplay(ByVal title As String, ByVal desc As String)
		Dim html As String
		'create HTML string for displaying description text already formatted
		html = CreateHtmlText(title, desc)
		'pass the HTML string to the WebBrowser control for display
		Me.descWebBrowser.DocumentText = html

	End Sub

	' Provide an accessor for the browserAddressTextBox control
	Private Property browserUrl() As String
		Get
			Return browserAddressTextBox.Text.Trim()
		End Get
		Set(ByVal value As String)

			browserAddressTextBox.Text = value
		End Set
	End Property

	' Update status strip with status message
	Private Sub updateBrowserStatus(ByVal message As String)
		If message.Trim() = String.Empty Then
			message = "Ready"
		End If
		browserStatusLabel.Text = message
	End Sub

	Private Sub Navigate()
		If Not browserUrl.StartsWith("https://") AndAlso Not browserUrl.StartsWith("http://") Then
			browserUrl = "http://" & browserUrl()
		End If

		Try
			WebBrowser1.Navigate(New Uri(browserUrl))
		Catch ex As Exception
			MessageBox.Show("This is not a valid URL", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
		End Try
	End Sub

	Function CreateHtmlText(ByRef titleHtml As String, ByRef descHtml As String) As String
		Dim htmlCode As String
		'start concatenating the HTML code into one string
		htmlCode = "<html><body style='background:#4A6751; color:#E1E1E1'><h3>" & titleHtml _
			& "</h3>" & descHtml & "</body></html>"
		Return htmlCode
	End Function

	'Function to determine if there is a match in the title of the
	'search strings entered by the user.
	Function SoundAlertCheck() As Boolean
		Dim x As Integer
		'Load the Item title in a string for comparison
		Dim itemName As String = Me.lblSaleItemTitle.Text.ToUpper

		'Check if there is any items in the list. If there are
		'no items in the list there is not point in checking.
		If Not Me.lstSearchStrings.Items.Count = -1 Then
			For x = 0 To Me.lstSearchStrings.Items.Count - 1
				'Check if there is a matching string in the title of the item
				'If there is then return true, otherwise keep searching
				If Not itemName.IndexOf(Me.lstSearchStrings.Items(x).ToString.ToUpper, 0) = -1 Then
					Return True
					Exit Function
				End If
			Next x
			'Nothing matching the search strings was found
			'return false.
			Return False
		End If
	End Function

	Private Sub PlayAlert()
		Me.tmrAlert.Start()
	End Sub

	Private Sub UpdateMouseHoverTip()

		Dim catString As String
		If wootOff Then
			If Me.lblSaleItemTitle.Text.Length > 20 Then
				catString = Me.lblSaleItemTitle.Text.Substring(0, 20)
			Else
				catString = Me.lblSaleItemTitle.Text
			End If
			'fill the balloon tip with the current items information
			Me.ntfySystemTray.Text = catString & ControlChars.NewLine & "Price: " & _
				 Me.lblItemPrice.Text & ControlChars.NewLine & Me.lblPercentRemaining.Text
		Else
			If Me.lblSaleItemTitle.Text.Length > 20 Then
				catString = Me.lblSaleItemTitle.Text.Substring(0, 20)
			Else
				catString = Me.lblSaleItemTitle.Text
			End If
			'fill the balloon tip with the current items information
			Me.ntfySystemTray.Text = catString & ControlChars.NewLine & "Price: " & _
				 Me.lblItemPrice.Text
		End If


	End Sub


	Private Sub DisplayBalloonTip()
		Dim displayString As String = Me.lblProductCondition.Text & ControlChars.Tab & _
			ControlChars.Tab & "Price: " & Me.lblItemPrice.Text
		'Me.ntfySystemTray.BalloonTipIcon = ToolTipIcon.Info
		Me.ntfySystemTray.BalloonTipTitle = Me.lblSaleItemTitle.Text
		Me.ntfySystemTray.BalloonTipText = displayString
		Me.ntfySystemTray.ShowBalloonTip(3000)
	End Sub
#End Region

#Region "Browser Navigation"


	Private Sub browserGoButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles browserGoButton.Click
		Navigate()
	End Sub

	Private Sub browserBackButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles browserBackButton.Click
		WebBrowser1.GoBack()
	End Sub

	Private Sub browserForwardButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles browserForwardButton.Click
		WebBrowser1.GoForward()
	End Sub

	Private Sub webBrowser1_Navigated(ByVal sender As Object, ByVal e As WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
		' Refresh Address after navigation, in case redirects occurred
		browserUrl = Me.WebBrowser1.document.Url.ToString
		updateBrowserStatus(String.Empty)
	End Sub

	Private Sub webBrowser1_Navigating(ByVal sender As Object, ByVal e As WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
		' Provide feedback to user that the browser is busy
		updateBrowserStatus("Navigating...")
	End Sub

	Private Sub browserRefreshButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles browserRefreshButton.Click
		WebBrowser1.Refresh()
	End Sub

	Private Sub browserStopButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles browserStopButton.Click
		WebBrowser1.Stop()
	End Sub

	Private Sub browserAddressTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles browserAddressTextBox.Click
		'On entry select the entire contents of the address TextBox
		Me.browserAddressTextBox.SelectAll()
	End Sub

	Private Sub browserAddressTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles browserAddressTextBox.KeyDown
		' Navigate if the ENTER key is pressed
		If e.KeyCode = Keys.Return Then
			Navigate()
		End If
	End Sub
#End Region

#Region "Timers"

	Private Sub tmrAlert_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrAlert.Tick
		My.Computer.Audio.Play(Application.StartupPath & "\Sounds\notify.wav")
	End Sub

	Private Sub refreshTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrRefresh.Tick
		'Refresh the information currently displayed
		LoadXmlDocument()
	End Sub

	Private Sub tmrNoWootRefresh_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrNoWootRefresh.Tick
		'Refresh the information currently displayed
		LoadXmlDocument()
	End Sub
#End Region


End Class

0

capty99 Icon

01 June 2007 - 09:25 AM
searched for woot off tracker and it was first page of google. nice work.
many dl's?
0

Jayman Icon

01 June 2007 - 06:48 PM

Tyler James Lee, on 1 Jun, 2007 - 09:25 AM, said:

searched for woot off tracker and it was first page of google. nice work.
many dl's?

Since the release date of 5/01/07 there has been 480 downloads, as of today. I had 300+ downloads during this recent woot-off.

A lot more than I ever expected. :)
0
Page 1 of 1

September 2014

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
2829 30     

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)

Recent Comments