作者:VB.NET开发
项目:System.Deployment.Applicatio
Dim WithEvents ADLaunchAppUpdate As ApplicationDeployment
Public Sub LaunchAppUpdate()
If (ApplicationDeployment.IsNetworkDeployed) Then
ADLaunchAppUpdate = ApplicationDeployment.CurrentDeployment
End If
End Sub
Private Sub ADLaunchAppUpdate_UpdateCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) Handles ADLaunchAppUpdate.UpdateCompleted
If Not (e.Error Is Nothing) Then
MessageBox.Show("Could not install application update. Please try again later, or contact a system administrator.", "Application Update Error")
Exit Sub
Else
If (e.Cancelled) Then
MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled")
Exit Sub
End If
End If
' Process successful update.
Dim dr As DialogResult = MessageBox.Show("The application has been updated. Restart?", "Restart Application", MessageBoxButtons.OKCancel)
If (System.Windows.Forms.DialogResult.OK = dr) Then
Application.Restart()
End If
End Sub