Make ProgressDialog public
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 1d 13m
- Merged PRs (30d)
- 85
Description
### Background and motivation
If we decide to make DownloadFileAsync public, making ProgressDialog public would greatly simplify the design and anyone using it the API would have more control over behavior if ProgressDialog was public.
### API Proposal
```vb
Namespace Microsoft.VisualBasic.MyServices.Internal
'''
''' A dialog that shows progress used for Network.DownloadAsync and Network.UploadAsync
'''
Public NotInheritable Class ProgressDialog
Inherits Form
```
### API Usage
```vb
'''
''' Centralize setup a ProgressDialog to be used with FileDownload and FileUpload.
'''
''' Address to the remote file, http, ftp etc...
''' Name and path of file where download is saved.
''' Indicates whether or not to show a progress bar.
''' New ProgressDialog.
Friend Function GetProgressDialog(
address As String,
destinationFileName As String,
showUI As Boolean) As ProgressDialog
If showUI AndAlso Environment.UserInteractive Then
'Construct the local file. This will validate the full name and path
Dim fullFilename As String = FileSystemUtils.NormalizeFilePath(path:=destinationFileName, paramName:=NameOf(destinationFileName))
Return New ProgressDialog With {
.Text = Utils.GetResourceString(SR.ProgressDialogDownloadingTitle, address),
.LabelText = Utils.GetResourceString(SR.ProgressDialogDownloadingLabel, address, fullFilename)
}
End If
Return Nothing
End Function
If showUI AndAlso Environment.UserInteractive Then
'Construct the local file. This will validate the full name and path
Dim fullFilename As String = CompilerServices.FileSystemUtils.NormalizeFilePath(destinationFileName, NameOf(destinationFileName))
dialog = GetProgressDialog(address, destinationFileName, showUI)
End If
Dim t As Task = DownloadFileAsync(
addressUri,
destinationFileName,
networkCredentials,
dialog,
connectionTimeout,
overwrite,
```
### Alternative Designs
User will have to invent their own ProgressDialog
### Risks
Low it already exists and is use in WinForms Repo
### Will this feature affect UI controls?
Documentation for New control will be needed
VS Designer will not need to support
Since it is currently used in FileUpload and FileDownload accessibility and localization are already covered.
Contributor guide
Assessment
This issue has not been assessed yet.