作者:VB.NET开发
项目:System.Deployment.Applicatio
Dim WithEvents ADDownloadHelpFiles As ApplicationDeployment
Private Sub DownloadHelpFiles(ByVal GroupName As String)
If (ApplicationDeployment.IsNetworkDeployed) Then
ADDownloadHelpFiles = ApplicationDeployment.CurrentDeployment
If ADDownloadHelpFiles.IsFirstRun Then
Try
If Not ADDownloadHelpFiles.IsFileGroupDownloaded(GroupName) Then
ADDownloadHelpFiles.DownloadFileGroupAsync(GroupName)
End If
Catch ioe As InvalidOperationException
MessageBox.Show("This application is not a ClickOnce application.")
Return
End Try
End If
End If
End Sub
Private Sub ADDownloadHelpFiles_DownloadFileGroupProgressChanged(ByVal sender As Object, ByVal e As DeploymentProgressChangedEventArgs) Handles ADDownloadHelpFiles.DownloadFileGroupProgressChanged
DownloadStatus.Text = String.Format("Downloading file group {0}; {1:D}K of {2:D}K completed.", e.Group, e.BytesCompleted / 1024, e.BytesTotal / 1024)
End Sub
Private Sub ADDownloadHelpFiles_DownloadFileGroupCompleted(ByVal sender As Object, ByVal e As DownloadFileGroupCompletedEventArgs) Handles ADDownloadHelpFiles.DownloadFileGroupCompleted
DownloadStatus.Text = String.Format("Download of file group {0} complete.", e.Group)
End Sub