It is the following, I have a desktop application that copies a folder with several files from one location to another, however, when the files are being copied the application hangs, it appears that the system is not responding, and only unlock after the transfer of the files is completed. data. I also have a ProgressBar that would be to show the progress of the download, but as the application hangs it starts to populate the ProgressBar and once it unlocks it is already all populated. How can I make sure that the system does not lock during transfer and progressbar also works correctly. Use the template available in the documentation.
(Google translator)
Sub CopyFileOrFolder (source As FolderItem, destination As FolderItem)
Dim newFolder As FolderItem
If source.Directory Then // it's a folder
newFolder = destination.Child (source.Name)
newFolder.CreateAsFolder
For i As Integer = 1 To source.Count // go through each item
If source.Item (i) .Directory Then
// it's a folder
CopyFileOrFolder (source.Item (i), newFolder) // recursively call this routine passing it the folder
Else
source.Item (i) .CopyFileTo (newFolder) // it's a file so copy it
End If
Next
Else // it's not a folder
source.CopyFileTo (destination)
End If
End Sub