Hey
ich habe einen updater geschrieben
so es hat alles funktioniert bis ich versucht habe
die verbliebene zeit einzufügen also das er sie anzeigt
so
jetzt auf einmal geht progressbar nicht mehr und das mir das anzeigt wieviel mb von mb noch übrig sind
aber download geht
könnt ihr mir helfen ???
ich mache noch ein screen von den warnungen die mir gezeigt werden
[Only registered and activated users can see links. Click Here To Register...]
danke im vorraus wenn ihr mir helfen würdet :)
LG vbcji
ich habe einen updater geschrieben
so es hat alles funktioniert bis ich versucht habe
die verbliebene zeit einzufügen also das er sie anzeigt
so
jetzt auf einmal geht progressbar nicht mehr und das mir das anzeigt wieviel mb von mb noch übrig sind
aber download geht
könnt ihr mir helfen ???
Code:
Imports System.Net
Imports System.Timers
Public Class Update
Private WithEvents httpclient As WebClient
Dim Pfad As String = Nothing
Dim sw As New Stopwatch
Dim received As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("Bitte Datei in das Spielverzeichniss unter Update.exe speichern, die .exe ausführen und auf ersetzen klicken !", MsgBoxStyle.Information, "Information")
Me.Hide()
ShowDialog:
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName = Nothing Then
GoTo ShowDialog
End If
Pfad = SaveFileDialog1.FileName
Try
Me.Show()
httpclient = New WebClient
Dim URL As String = "http://www.weebly.com/uploads/2/1/9/9/21997230/updater.exe"
Application.DoEvents()
httpclient.DownloadFileAsync(New Uri(URL), Pfad)
Application.DoEvents()
Catch ex As Exception
MsgBox("ein Fehler ist aufgetreten:" & vbNewLine & ex.ToString, MsgBoxStyle.Critical, "Fehler")
End
End Try
End Sub
Private Sub httpclient_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles httpclient.DownloadFileCompleted
MsgBox("Download complete", MsgBoxStyle.Information, "Information")
End
End Sub
Private Sub httpclient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs)
Dim aTimer As New System.Timers.Timer()
AddHandler aTimer.Elapsed, New ElapsedEventHandler(AddressOf OnTimedEvent)
aTimer.Interval = 1000
Dim downloadsekunden As Integer = 0
Me.ProgressBar1.Value = e.ProgressPercentage
Dim Totalbytes As Double = Math.Round(e.TotalBytesToReceive \ 1024 \ 1024, 2)
Dim bytes As Double = Math.Round(e.BytesReceived \ 1024 \ 1024, 2)
Me.Label1.Text = bytes & "MB von " & Totalbytes & "MB"
aTimer.Enabled = True
End Sub
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
Downloadsekunden += 1
Dim averagedownload As Integer = bytes / Downloadsekunden
Dim restzeit As Integer = (Totalbytes - bytes) / averagedownload
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub Update_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If (e.Button = Windows.Forms.MouseButtons.Left) Then
Me.Capture = False
Me.WndProc(Message.Create(Me.Handle, &HA1, CType(&H2, IntPtr), IntPtr.Zero))
Else : End If
End Sub
Public Property Bytes() As Double
Get
Return bytes
End Get
Set(ByVal value As Double)
Me.bytes = value
End Set
End Property
Public Property Downloadsekunden() As Integer
Get
Return downloadsekunden
End Get
Set(ByVal value As Integer)
Me.downloadsekunden = value
End Set
End Property
Public Property Totalbytes() As Double
Get
Return Totalbytes
End Get
Set(ByVal value As Double)
Me.Totalbytes = value
End Set
End Property
End Class
ich mache noch ein screen von den warnungen die mir gezeigt werden
[Only registered and activated users can see links. Click Here To Register...]
danke im vorraus wenn ihr mir helfen würdet :)
LG vbcji