Advertisement
Brandan

SNOW REVISED

Jan 15th, 2012
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.74 KB | None | 0 0
  1.     Private Sub SNOW_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SNOW.Tick
  2.         On Error Resume Next
  3.         If BatteryStatus.GetStatus.BatteryLifePercent.ToString.Contains("20") Then
  4.             My.Computer.Audio.Play("C:\Emergency.wav", AudioPlayMode.BackgroundLoop)
  5.         End If
  6.         Dim generator As New Random
  7.         Dim randomValue As Integer
  8.         randomValue = generator.Next(1, 100000)
  9.         Dim URL = "http://forecast.weather.gov/MapClick.php?CityName=Beaverton&state=OR&site=PQR&lat=45.446&lon=-122.882"
  10.         Dim fileExists As Boolean
  11.         fileExists = My.Computer.FileSystem.FileExists("index.html")
  12.         If fileExists Then
  13.             Kill("index.html")
  14.         End If
  15.         My.Computer.Network.DownloadFile(URL, "index.html")
  16.         Dim fileContents As String
  17.         fileContents = My.Computer.FileSystem.ReadAllText("index.html")
  18.         TextBox1.Text = fileContents
  19.         Dim newhtml = TextBox1.Lines(50)
  20.         If newhtml.ToLower.Contains("snow".ToLower) Then
  21.             If slience = 1 Then
  22.                 My.Computer.Audio.Stop()
  23.             Else
  24.                 Label1.Text = "Yes."
  25.                 Label1.ForeColor = Color.Red
  26.                 Label1.BackColor = Color.Yellow
  27.                 My.Computer.Audio.Play("C:\Emergency.wav", AudioPlayMode.BackgroundLoop)
  28.             End If
  29.         ElseIf newhtml.ToLower.Contains("snow") = False Then
  30.             If slience = 1 Then
  31.                 slience = 0
  32.             End If
  33.             Label1.Text = "No."
  34.             Label1.ForeColor = Color.Chartreuse
  35.             Label1.BackColor = Color.Navy
  36.             My.Computer.Audio.Stop()
  37.         End If
  38.         CSS.Navigate(URL)
  39.         On Error Resume Next
  40.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement