Advertisement
Jimi2000

FTP_BackGroundWorker

Aug 25th, 2018
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 21.20 KB | None | 0 0
  1. 'frmBGWorkerDownload Code
  2. '-------------------------------------------------------------------
  3. Imports System.ComponentModel
  4. Imports System.Globalization
  5. Imports System.IO
  6. Imports System.Net
  7. Imports System.Net.Security
  8. Imports System.Security.Cryptography.X509Certificates
  9.  
  10. Public Class frmBGWorkerDownload
  11.  
  12.     Friend WithEvents BWorkerD As BackgroundWorker
  13.     Public Sub New()
  14.         InitializeComponent()
  15.         BWorkerD = New BackgroundWorker With {
  16.             .WorkerReportsProgress = True,
  17.             .WorkerSupportsCancellation = True
  18.         }
  19.     End Sub
  20.  
  21.     Private Class BGWorkerObject
  22.         Public Property UserName As String
  23.         Public Property Password As String
  24.         Public Property ResourceURI As String
  25.         Public Property FilePath As String
  26.         Public Property FileLength As Long
  27.         Public Property DownloadedBytes As Long
  28.         Public Property BytesToDownload As Long
  29.     End Class
  30.  
  31.     'ftp://185.201.11.24
  32.     'User: u171165696
  33.     'Pass: KU7KXW38
  34.     'File: Blender2.blend
  35.  
  36.     Private Sub btnDownload_Click(sender As Object, e As EventArgs) Handles btnDownload.Click
  37.         pBarD.Value = 0
  38.         Dim BGWorkerObj As BGWorkerObject = New BGWorkerObject With {
  39.             .ResourceURI = txtFilePathD.Text,
  40.             .FilePath = Path.Combine(txtSavePathD.Text, Path.GetFileName(txtFilePathD.Text)),
  41.             .UserName = txtFTPUsernameD.Text,
  42.             .Password = txtFTPPasswordD.Text
  43.         }
  44.         AddHandler BWorkerD.DoWork, AddressOf BWorkerD_DoWork
  45.         AddHandler BWorkerD.ProgressChanged, AddressOf BWorkerD_ProgressChanged
  46.         AddHandler BWorkerD.RunWorkerCompleted, AddressOf BWorkerD_RunWorkerCompleted
  47.         BWorkerD.RunWorkerAsync(BGWorkerObj)
  48.  
  49.     End Sub
  50.  
  51.  
  52.     Private Sub BWorkerD_DoWork(sender As Object, e As DoWorkEventArgs)
  53.  
  54.         Dim BGW As BackgroundWorker = TryCast(sender, BackgroundWorker)
  55.         Dim BGWorkerObj As BGWorkerObject = TryCast(e.Argument, BGWorkerObject)
  56.         Dim FTPRequest As FtpWebRequest
  57.         Dim BufferSize As Integer = 131072
  58.  
  59.         ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
  60.         ServicePointManager.ServerCertificateValidationCallback =
  61.             Function(snd As Object, Cert As X509Certificate, Chain As X509Chain, Err As SslPolicyErrors)
  62.                 Return True
  63.             End Function
  64.  
  65.         FTPRequest = DirectCast(WebRequest.Create(BGWorkerObj.ResourceURI), FtpWebRequest)
  66.         FTPRequest.Credentials = New NetworkCredential(BGWorkerObj.UserName, BGWorkerObj.Password)
  67.         FTPRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
  68.         FTPRequest.EnableSsl = True
  69.  
  70.         'Using FtpResponse As WebResponse = FTPRequest.GetResponse
  71.         '    BGWorkerObj.FileLength = Convert.ToInt64(FtpResponse.ContentLength)
  72.         '    BGW.ReportProgress(0, BGWorkerObj)
  73.         'End Using
  74.  
  75.         Using FtpResponse As WebResponse = FTPRequest.GetResponse
  76.             Using DirListStream As Stream = FtpResponse.GetResponseStream()
  77.                 Using listReader As StreamReader = New StreamReader(DirListStream)
  78.                     While Not listReader.EndOfStream
  79.                         Dim DirContent As String = listReader.ReadLine()
  80.                         If DirContent.Contains(Path.GetFileNameWithoutExtension(BGWorkerObj.ResourceURI)) Then
  81.                             BGWorkerObj.FileLength = Convert.ToInt64(DirContent.Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries)(4))
  82.                             BGW.ReportProgress(0, BGWorkerObj)
  83.                             Exit While
  84.                         End If
  85.                     End While
  86.                 End Using
  87.             End Using
  88.  
  89.         End Using
  90.  
  91.         If BGW.CancellationPending Then e.Cancel = True
  92.  
  93.         Try
  94.             FTPRequest = CType(WebRequest.Create(BGWorkerObj.ResourceURI), FtpWebRequest)
  95.             FTPRequest.EnableSsl = True
  96.             FTPRequest.Credentials = New NetworkCredential(BGWorkerObj.UserName, BGWorkerObj.Password)
  97.             FTPRequest.Method = WebRequestMethods.Ftp.DownloadFile
  98.  
  99.             Using Response As FtpWebResponse = DirectCast(FTPRequest.GetResponse, FtpWebResponse)
  100.                 If Response.StatusCode > 299 Then
  101.                     e.Result = 0
  102.                     Throw New Exception("The Ftp Server rejected the request. StatusCode: " &
  103.                                         Response.StatusCode.ToString(),
  104.                                         New InvalidOperationException(Response.StatusCode.ToString()))
  105.                     Exit Sub
  106.                 End If
  107.                 Using stream = Response.GetResponseStream
  108.                     Using fileStream As FileStream = File.Create(BGWorkerObj.FilePath)
  109.                         Dim read As Integer
  110.                         Dim buffer As Byte() = New Byte(BufferSize - 1) {}
  111.                         Do
  112.                             read = stream.Read(buffer, 0, buffer.Length)
  113.                             fileStream.Write(buffer, 0, read)
  114.                             BGWorkerObj.DownloadedBytes += read
  115.                             BGWorkerObj.BytesToDownload = BGWorkerObj.FileLength - BGWorkerObj.DownloadedBytes
  116.  
  117.                             If BGW.CancellationPending Then
  118.                                 e.Cancel = True
  119.                                 Exit Do
  120.                             Else
  121.                                 If BGWorkerObj.FileLength > 0 Then
  122.                                     BGW.ReportProgress(CInt((CSng(BGWorkerObj.DownloadedBytes) / BGWorkerObj.FileLength) * 100), BGWorkerObj)
  123.                                 Else
  124.                                     BGW.ReportProgress(0, BGWorkerObj)
  125.                                 End If
  126.  
  127.  
  128.                             End If
  129.                         Loop While read > 0
  130.                     End Using
  131.                 End Using
  132.             End Using
  133.  
  134.         Catch ex As Exception
  135.             If e.Cancel = False Then Throw
  136.         Finally
  137.             If e.Cancel = True Then
  138.                 If File.Exists(BGWorkerObj.FilePath) Then
  139.                     File.Delete(BGWorkerObj.FilePath)
  140.                 End If
  141.             End If
  142.         End Try
  143.  
  144.     End Sub
  145.  
  146.     Private Sub BWorkerD_ProgressChanged(sender As Object, e As ProgressChangedEventArgs)
  147.  
  148.         pBarD.Value = e.ProgressPercentage
  149.         lblPercentD.Text = e.ProgressPercentage.ToString() & " %"
  150.  
  151.         If lblFileSizeD.Text.Length = 0 Then
  152.             lblFileSizeD.Text = CType(e.UserState, BGWorkerObject).FileLength.ToString("N0", CultureInfo.CurrentUICulture.NumberFormat)
  153.         End If
  154.         lblDownloadedBytesD.Text = CType(e.UserState, BGWorkerObject).DownloadedBytes.ToString("N0", CultureInfo.CurrentUICulture.NumberFormat)
  155.         If e.ProgressPercentage <= 15 Then
  156.             lblDownloadedBytesD.ForeColor = Color.Red
  157.         ElseIf e.ProgressPercentage <= 66 Then
  158.             lblDownloadedBytesD.ForeColor = Color.Orange
  159.         Else
  160.             lblDownloadedBytesD.ForeColor = Color.LightGreen
  161.         End If
  162.     End Sub
  163.  
  164.     Private Sub BWorkerD_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
  165.         Dim DownloadAborted As Boolean = False
  166.         If e.Error IsNot Nothing Then
  167.             DownloadAborted = True
  168.             lblDownloadedBytesD.ForeColor = Color.Red
  169.             lblDownloadedBytesD.Text = "Error!"
  170.         ElseIf e.Cancelled Then
  171.             DownloadAborted = True
  172.             lblDownloadedBytesD.ForeColor = Color.Yellow
  173.             lblDownloadedBytesD.Text = "Cancelled!"
  174.             pBarD.Value = 0
  175.             lblPercentD.Text = "0%"
  176.         Else
  177.             lblDownloadedBytesD.ForeColor = Color.LightGreen
  178.             lblDownloadedBytesD.Text = "Download completed"
  179.         End If
  180.  
  181.         RemoveHandler BWorkerD.DoWork, AddressOf BWorkerD_DoWork
  182.         RemoveHandler BWorkerD.ProgressChanged, AddressOf BWorkerD_ProgressChanged
  183.         RemoveHandler BWorkerD.RunWorkerCompleted, AddressOf BWorkerD_RunWorkerCompleted
  184.  
  185.     End Sub
  186.  
  187.     Private Sub btnAbortDownload_Click(sender As Object, e As EventArgs) Handles btnAbortDownload.Click
  188.         BWorkerD.CancelAsync()
  189.     End Sub
  190.  
  191.     Private Sub btnOpenPath_Click(sender As Object, e As EventArgs) Handles btnOpenPath.Click
  192.         Using fbDialog As FolderBrowserDialog = New FolderBrowserDialog()
  193.             fbDialog.ShowNewFolderButton = True
  194.             If fbDialog.ShowDialog(Me) <> DialogResult.OK Then Return
  195.             txtSavePathD.Text = fbDialog.SelectedPath
  196.         End Using
  197.     End Sub
  198. End Class
  199.  
  200. '-------------------------------------------------------------------
  201. 'frmBGWorkerDownload Designer Code
  202. '-------------------------------------------------------------------
  203. <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
  204. Partial Class frmBGWorkerDownload
  205.     Inherits System.Windows.Forms.Form
  206.  
  207.     <System.Diagnostics.DebuggerNonUserCode()>
  208.     Protected Overrides Sub Dispose(ByVal disposing As Boolean)
  209.         Try
  210.             If disposing AndAlso components IsNot Nothing Then
  211.                 components.Dispose()
  212.             End If
  213.         Finally
  214.             MyBase.Dispose(disposing)
  215.         End Try
  216.     End Sub
  217.  
  218.     Private components As System.ComponentModel.IContainer
  219.  
  220.     <System.Diagnostics.DebuggerStepThrough()>
  221.     Private Sub InitializeComponent()
  222.         Me.btnDownload = New System.Windows.Forms.Button()
  223.         Me.txtFTPUsernameD = New System.Windows.Forms.TextBox()
  224.         Me.txtFTPPasswordD = New System.Windows.Forms.TextBox()
  225.         Me.lblFileSizeD = New System.Windows.Forms.Label()
  226.         Me.Label1 = New System.Windows.Forms.Label()
  227.         Me.pBarD = New System.Windows.Forms.ProgressBar()
  228.         Me.Label2 = New System.Windows.Forms.Label()
  229.         Me.lblDownloadedBytesD = New System.Windows.Forms.Label()
  230.         Me.txtFilePathD = New System.Windows.Forms.TextBox()
  231.         Me.Label4 = New System.Windows.Forms.Label()
  232.         Me.Label5 = New System.Windows.Forms.Label()
  233.         Me.Label6 = New System.Windows.Forms.Label()
  234.         Me.Label3 = New System.Windows.Forms.Label()
  235.         Me.txtSavePathD = New System.Windows.Forms.TextBox()
  236.         Me.lblPercentD = New System.Windows.Forms.Label()
  237.         Me.btnAbortDownload = New System.Windows.Forms.Button()
  238.         Me.btnOpenPath = New System.Windows.Forms.Button()
  239.         Me.SuspendLayout()
  240.         '
  241.         'btnDownload
  242.         '
  243.         Me.btnDownload.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(0, Byte), Integer))
  244.         Me.btnDownload.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(0, Byte), Integer))
  245.         Me.btnDownload.FlatStyle = System.Windows.Forms.FlatStyle.Flat
  246.         Me.btnDownload.Location = New System.Drawing.Point(25, 305)
  247.         Me.btnDownload.Name = "btnDownload"
  248.         Me.btnDownload.Size = New System.Drawing.Size(111, 38)
  249.         Me.btnDownload.TabIndex = 0
  250.         Me.btnDownload.Text = "Download"
  251.         Me.btnDownload.UseVisualStyleBackColor = True
  252.         '
  253.         'txtFTPUsernameD
  254.         '
  255.         Me.txtFTPUsernameD.BackColor = System.Drawing.Color.DarkOliveGreen
  256.         Me.txtFTPUsernameD.ForeColor = System.Drawing.Color.White
  257.         Me.txtFTPUsernameD.Location = New System.Drawing.Point(24, 38)
  258.         Me.txtFTPUsernameD.Name = "txtFTPUsernameD"
  259.         Me.txtFTPUsernameD.Size = New System.Drawing.Size(231, 23)
  260.         Me.txtFTPUsernameD.TabIndex = 1
  261.         Me.txtFTPUsernameD.Text = "u171165696"
  262.         '
  263.         'txtFTPPasswordD
  264.         '
  265.         Me.txtFTPPasswordD.BackColor = System.Drawing.Color.DarkOliveGreen
  266.         Me.txtFTPPasswordD.ForeColor = System.Drawing.Color.White
  267.         Me.txtFTPPasswordD.Location = New System.Drawing.Point(277, 38)
  268.         Me.txtFTPPasswordD.Name = "txtFTPPasswordD"
  269.         Me.txtFTPPasswordD.Size = New System.Drawing.Size(231, 23)
  270.         Me.txtFTPPasswordD.TabIndex = 2
  271.         Me.txtFTPPasswordD.Text = "KU7KXW38"
  272.         '
  273.         'lblFileSizeD
  274.         '
  275.         Me.lblFileSizeD.BackColor = System.Drawing.Color.FromArgb(CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer))
  276.         Me.lblFileSizeD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
  277.         Me.lblFileSizeD.ForeColor = System.Drawing.Color.White
  278.         Me.lblFileSizeD.Location = New System.Drawing.Point(78, 213)
  279.         Me.lblFileSizeD.Name = "lblFileSizeD"
  280.         Me.lblFileSizeD.Size = New System.Drawing.Size(164, 24)
  281.         Me.lblFileSizeD.TabIndex = 3
  282.         Me.lblFileSizeD.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
  283.         '
  284.         'Label1
  285.         '
  286.         Me.Label1.AutoSize = True
  287.         Me.Label1.ForeColor = System.Drawing.Color.White
  288.         Me.Label1.Location = New System.Drawing.Point(21, 218)
  289.         Me.Label1.Name = "Label1"
  290.         Me.Label1.Size = New System.Drawing.Size(51, 15)
  291.         Me.Label1.TabIndex = 4
  292.         Me.Label1.Text = "File Size:"
  293.         '
  294.         'pBarD
  295.         '
  296.         Me.pBarD.ForeColor = System.Drawing.Color.Red
  297.         Me.pBarD.Location = New System.Drawing.Point(24, 256)
  298.         Me.pBarD.Name = "pBarD"
  299.         Me.pBarD.Size = New System.Drawing.Size(448, 25)
  300.         Me.pBarD.Style = System.Windows.Forms.ProgressBarStyle.Continuous
  301.         Me.pBarD.TabIndex = 5
  302.         '
  303.         'Label2
  304.         '
  305.         Me.Label2.AutoSize = True
  306.         Me.Label2.ForeColor = System.Drawing.Color.White
  307.         Me.Label2.Location = New System.Drawing.Point(265, 218)
  308.         Me.Label2.Name = "Label2"
  309.         Me.Label2.Size = New System.Drawing.Size(69, 15)
  310.         Me.Label2.TabIndex = 7
  311.         Me.Label2.Text = "Completed:"
  312.         '
  313.         'lblDownloadedBytesD
  314.         '
  315.         Me.lblDownloadedBytesD.BackColor = System.Drawing.Color.FromArgb(CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer))
  316.         Me.lblDownloadedBytesD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
  317.         Me.lblDownloadedBytesD.ForeColor = System.Drawing.Color.Green
  318.         Me.lblDownloadedBytesD.Location = New System.Drawing.Point(340, 213)
  319.         Me.lblDownloadedBytesD.Name = "lblDownloadedBytesD"
  320.         Me.lblDownloadedBytesD.Size = New System.Drawing.Size(168, 24)
  321.         Me.lblDownloadedBytesD.TabIndex = 6
  322.         Me.lblDownloadedBytesD.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
  323.         '
  324.         'txtFilePathD
  325.         '
  326.         Me.txtFilePathD.BackColor = System.Drawing.Color.Gainsboro
  327.         Me.txtFilePathD.ForeColor = System.Drawing.Color.Black
  328.         Me.txtFilePathD.Location = New System.Drawing.Point(24, 96)
  329.         Me.txtFilePathD.Name = "txtFilePathD"
  330.         Me.txtFilePathD.Size = New System.Drawing.Size(484, 23)
  331.         Me.txtFilePathD.TabIndex = 8
  332.         Me.txtFilePathD.Text = "ftp://185.201.11.24/Blender2.blend"
  333.         '
  334.         'Label4
  335.         '
  336.         Me.Label4.AutoSize = True
  337.         Me.Label4.ForeColor = System.Drawing.Color.White
  338.         Me.Label4.Location = New System.Drawing.Point(21, 20)
  339.         Me.Label4.Name = "Label4"
  340.         Me.Label4.Size = New System.Drawing.Size(68, 15)
  341.         Me.Label4.TabIndex = 9
  342.         Me.Label4.Text = "User Name:"
  343.         '
  344.         'Label5
  345.         '
  346.         Me.Label5.AutoSize = True
  347.         Me.Label5.ForeColor = System.Drawing.Color.White
  348.         Me.Label5.Location = New System.Drawing.Point(274, 20)
  349.         Me.Label5.Name = "Label5"
  350.         Me.Label5.Size = New System.Drawing.Size(60, 15)
  351.         Me.Label5.TabIndex = 10
  352.         Me.Label5.Text = "Password:"
  353.         '
  354.         'Label6
  355.         '
  356.         Me.Label6.AutoSize = True
  357.         Me.Label6.ForeColor = System.Drawing.Color.White
  358.         Me.Label6.Location = New System.Drawing.Point(21, 78)
  359.         Me.Label6.Name = "Label6"
  360.         Me.Label6.Size = New System.Drawing.Size(115, 15)
  361.         Me.Label6.TabIndex = 11
  362.         Me.Label6.Text = "Download Resource:"
  363.         '
  364.         'Label3
  365.         '
  366.         Me.Label3.AutoSize = True
  367.         Me.Label3.ForeColor = System.Drawing.Color.White
  368.         Me.Label3.Location = New System.Drawing.Point(21, 132)
  369.         Me.Label3.Name = "Label3"
  370.         Me.Label3.Size = New System.Drawing.Size(97, 15)
  371.         Me.Label3.TabIndex = 13
  372.         Me.Label3.Text = "Destination Path:"
  373.         '
  374.         'txtSavePathD
  375.         '
  376.         Me.txtSavePathD.BackColor = System.Drawing.Color.Gainsboro
  377.         Me.txtSavePathD.ForeColor = System.Drawing.Color.Black
  378.         Me.txtSavePathD.Location = New System.Drawing.Point(24, 150)
  379.         Me.txtSavePathD.Name = "txtSavePathD"
  380.         Me.txtSavePathD.Size = New System.Drawing.Size(448, 23)
  381.         Me.txtSavePathD.TabIndex = 12
  382.         '
  383.         'lblPercentD
  384.         '
  385.         Me.lblPercentD.ForeColor = System.Drawing.Color.White
  386.         Me.lblPercentD.Location = New System.Drawing.Point(472, 253)
  387.         Me.lblPercentD.Name = "lblPercentD"
  388.         Me.lblPercentD.Size = New System.Drawing.Size(41, 28)
  389.         Me.lblPercentD.TabIndex = 14
  390.         Me.lblPercentD.Text = "0%"
  391.         Me.lblPercentD.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  392.         '
  393.         'btnAbortDownload
  394.         '
  395.         Me.btnAbortDownload.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(0, Byte), Integer))
  396.         Me.btnAbortDownload.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(0, Byte), Integer))
  397.         Me.btnAbortDownload.FlatStyle = System.Windows.Forms.FlatStyle.Flat
  398.         Me.btnAbortDownload.Location = New System.Drawing.Point(155, 305)
  399.         Me.btnAbortDownload.Name = "btnAbortDownload"
  400.         Me.btnAbortDownload.Size = New System.Drawing.Size(111, 38)
  401.         Me.btnAbortDownload.TabIndex = 15
  402.         Me.btnAbortDownload.Text = "Abort Download"
  403.         Me.btnAbortDownload.UseVisualStyleBackColor = True
  404.         '
  405.         'btnOpenPath
  406.         '
  407.         Me.btnOpenPath.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(0, Byte), Integer))
  408.         Me.btnOpenPath.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(0, Byte), Integer))
  409.         Me.btnOpenPath.FlatStyle = System.Windows.Forms.FlatStyle.Flat
  410.         Me.btnOpenPath.Font = New System.Drawing.Font("Segoe UI Symbol", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  411.         Me.btnOpenPath.Location = New System.Drawing.Point(478, 151)
  412.         Me.btnOpenPath.Name = "btnOpenPath"
  413.         Me.btnOpenPath.Size = New System.Drawing.Size(30, 22)
  414.         Me.btnOpenPath.TabIndex = 16
  415.         Me.btnOpenPath.Text = "⋯"
  416.         Me.btnOpenPath.UseVisualStyleBackColor = True
  417.         '
  418.         'frmBGWorkerDownload
  419.         '
  420.         Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
  421.         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
  422.         Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer))
  423.         Me.ClientSize = New System.Drawing.Size(527, 364)
  424.         Me.Controls.Add(Me.btnOpenPath)
  425.         Me.Controls.Add(Me.btnAbortDownload)
  426.         Me.Controls.Add(Me.lblPercentD)
  427.         Me.Controls.Add(Me.Label3)
  428.         Me.Controls.Add(Me.txtSavePathD)
  429.         Me.Controls.Add(Me.Label6)
  430.         Me.Controls.Add(Me.Label5)
  431.         Me.Controls.Add(Me.Label4)
  432.         Me.Controls.Add(Me.txtFilePathD)
  433.         Me.Controls.Add(Me.Label2)
  434.         Me.Controls.Add(Me.lblDownloadedBytesD)
  435.         Me.Controls.Add(Me.pBarD)
  436.         Me.Controls.Add(Me.Label1)
  437.         Me.Controls.Add(Me.lblFileSizeD)
  438.         Me.Controls.Add(Me.txtFTPPasswordD)
  439.         Me.Controls.Add(Me.txtFTPUsernameD)
  440.         Me.Controls.Add(Me.btnDownload)
  441.         Me.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  442.         Me.ForeColor = System.Drawing.Color.White
  443.         Me.Name = "frmBGWorkerDownload"
  444.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  445.         Me.Text = "Ftp Download with BackGroundWorker"
  446.         Me.ResumeLayout(False)
  447.         Me.PerformLayout()
  448.  
  449.     End Sub
  450.  
  451.     Friend WithEvents btnDownload As Button
  452.     Friend WithEvents txtFTPUsernameD As TextBox
  453.     Friend WithEvents txtFTPPasswordD As TextBox
  454.     Friend WithEvents lblFileSizeD As Label
  455.     Friend WithEvents Label1 As Label
  456.     Friend WithEvents pBarD As ProgressBar
  457.     Friend WithEvents Label2 As Label
  458.     Friend WithEvents lblDownloadedBytesD As Label
  459.     Friend WithEvents txtFilePathD As TextBox
  460.     Friend WithEvents Label4 As Label
  461.     Friend WithEvents Label5 As Label
  462.     Friend WithEvents Label6 As Label
  463.     Friend WithEvents Label3 As Label
  464.     Friend WithEvents txtSavePathD As TextBox
  465.     Friend WithEvents lblPercentD As Label
  466.     Friend WithEvents btnAbortDownload As Button
  467.     Friend WithEvents btnOpenPath As Button
  468. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement