Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 22nd, 2012  |  syntax: None  |  size: 1.64 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Imports System.Net
  2.  
  3. Public Class Form1
  4.     WithEvents webclient2 As New WebClient
  5.     WithEvents webclient1 As New WebClient
  6.     WithEvents webclient3 As New WebClient
  7.     Dim versaoatual As String = "C:\uac\atual.dll"
  8.  
  9.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  10.         Dim versaodosite As String = webclient1.DownloadString("http://www.ultimateprojects.com.br/downloads/versao.php")
  11.  
  12.         If versaodosite > versaoatual Then
  13.  
  14.  
  15.             MessageBox.Show("Nova versão disponível: " & versaodosite & ". Após o Download reinicie programa.")
  16.  
  17.             webclient2.DownloadFileAsync(New Uri("http://www.ultimateprojects.com.br/downloads/UAC.jar"), "C:\uac\UAC.jar")
  18.             webclient3.DownloadFileAsync(New Uri("http://www.ultimateprojects.com.br/download/atual.dll"), "C:\uac\atual.dll")
  19.         Else
  20.             MessageBox.Show("A sua versão é a utlima disponível: " & versaodosite & " faça um bom uso ! ")
  21.  
  22.             Shell("C:\uac\UAC.jar")
  23.  
  24.  
  25.         End If
  26.     End Sub
  27.     Private Sub webclient2_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles webclient2.DownloadFileCompleted
  28.         MessageBox.Show("Os arquivos da atualização foram baixados com sucesso, reinicie o programa")
  29.  
  30.     End Sub
  31.  
  32.     Private Sub webclient2_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles webclient2.DownloadProgressChanged
  33.         ProgressBar1.Maximum = e.TotalBytesToReceive
  34.         ProgressBar1.Value = e.BytesReceived
  35.     End Sub
  36. End Class