Post by Sential on Feb 12, 2015 6:14:34 GMT 10
I want to add downloads panel to my web browser but it's doesn't working help me. I don't know what is the problem Public Class Downloads
Inherits DBPanel
Public downloadCount As Integer = 0
Public Function adddownload(ByVal url As String, ByVal filepath As String, ByVal name As String)
Dim mini As New MiniDownload(url, filepath, name)
mini.Size = New Size(342, 100)
mini.Location = New System.Drawing.Point((downloadCount * mini.Height) + ((downloadCount + 1) * 0), 0)
Me.Controls.Add(mini)
downloadCount += 1
Return (False)
End Function
End Class
Imports System.Net
Public Class MiniDownload
Dim client As WebClient
Dim dlurl As String
Dim dlpath As String
Dim dlname As String
Sub New(ByVal url As String, ByVal filepath As String, ByVal name As String)
dlurl = url
dlpath = filepath
dlname = name
InitializeComponent()
Timer1.Start()
AddHandler client.DownloadProgressChanged, AddressOf DownloadProgressChanged
End Sub
Private Sub DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs)
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Timer1.Stop()
client = New WebClient
Try
client.DownloadFileAsync(New Uri(dlurl), My.Computer.FileSystem.CombinePath(dlpath, dlname))
Catch : End Try
End Sub
End Class
Private Sub OnDownload(sender As Awesomium.Core.WebView, e As Awesomium.Core.DownloadEventArgs)
On Error Resume Next
e.Handled = True
Dim filepath As String = Nothing
Dim filename As String = Nothing
If My.Settings.Downloads = "downloads" Then
filepath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Else
filepath = My.Settings.Downloads
End If
Dim pathChooser As New FolderBrowserDialog
pathChooser.SelectedPath = filepath
Downloads1.adddownload(e.Url.ToString, pathChooser.SelectedPath, e.SuggestedFileName)
End Sub
|
|
Post by Nathan Lecompte on Feb 12, 2015 14:22:37 GMT 10
What does the error say or what does the form look like when you debug (screenshot)?
|
|
Post by Sential on Feb 12, 2015 22:47:27 GMT 10
It doesn't say any errors but the download isn't adding to a downloads panel.
|
|
Post by Nathan Lecompte on Feb 13, 2015 7:35:17 GMT 10
I don't think you've added a handler for the OnDownload sub by the looks of it (unless that's in a different form)...
|
|
Post by Sential on Feb 14, 2015 4:20:01 GMT 10
There is a handler OnDownload in the form1 AddHandler Awesomium.Core.WebCore.Download, AddressOf OnDownload
Last Edit: Feb 14, 2015 4:21:21 GMT 10 by Sential
|
|
Post by Sential on Feb 15, 2015 8:20:16 GMT 10
Ok, solved!
|
|