I have a an application that check the availability of an update with clickonce, I use CheckForUpdateAsync method.
Sometime CheckForUpdateCompleted is raised and sometime no, this is not even.
I am not able to find the motivation of this irregularity.
My code work, so the problem is not any time.
Giuseppe
| | Giuseppe Porcelli Sunday, October 23, 2005 11:56 AM | Giueseppe could you share your application code. There is no know issue that should cause this to happen. | | Saurabh Pant Tuesday, October 25, 2005 1:40 AM | Private sizeOfUpdate As Long = 0 Dim WithEvents ADUpdateAsync As ApplicationDeployment Private Sub UpdateApplication() Try If (ApplicationDeployment.IsNetworkDeployed) Then ADUpdateAsync = ApplicationDeployment.CurrentDeployment ADUpdateAsync.CheckForUpdateAsync() Else MessageBox.Show( "Applicazione non eseguita in Rete", "DbConnect 2006", MessageBoxButtons.OK, MessageBoxIcon.Information) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation) End Try End Sub Sub ADUpdateAsync_CheckForUpdateProgressChanged(ByVal sender As Object, ByVal e As DeploymentProgressChangedEventArgs) Handles ADUpdateAsync.CheckForUpdateProgressChanged DownloadStatus.Text = CInt(e.BytesCompleted / 1024) & "K di " & CInt(e.BytesTotal / 1024) & "K scaricati" End Sub Sub ADUpdateAsync_CheckForUpdateCompleted(ByVal sender As Object, ByVal e As CheckForUpdateCompletedEventArgs) Handles ADUpdateAsync.CheckForUpdateCompleted Try 'MsgBox("CheckForUpdate finito") If (e.Error IsNot Nothing) Then MessageBox.Show(( "ERROR: Could not retrieve new version of the application. Reason: " + ControlChars.Lf + e.Error.Message + ControlChars.Lf + "Please report this error to the system administrator.")) Return Else If (e.Cancelled = True) Then MessageBox.Show( "The update was cancelled.") End If End If ' Ask the user if they would like to update the application now. If (e.UpdateAvailable) Then sizeOfUpdate = e.UpdateSizeBytes If (Not e.IsUpdateRequired) Then Dim dr As DialogResult = MessageBox.Show("E' disponibile un aggiornamento per l'applicazione, aggiornare adesso ?", "DbConnect 2006", MessageBoxButtons.OKCancel) If (System.Windows.Forms.DialogResult.OK = dr) Then BeginUpdate() End If Else MessageBox.Show( "A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application.") BeginUpdate() End If Else MessageBox.Show( "Nessun aggiornamento disponibile sul server.", "DbConnect 2006", MessageBoxButtons.OK, MessageBoxIcon.Information) End If Me.AggiornaToolStripButton.Enabled = True Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub BeginUpdate() ADUpdateAsync = ApplicationDeployment.CurrentDeployment ADUpdateAsync.UpdateAsync() End Sub Sub ADUpdateAsync_UpdateProgressChanged(ByVal sender As Object, ByVal e As DeploymentProgressChangedEventArgs) Handles ADUpdateAsync.UpdateProgressChanged Dim progressText As String = CInt(e.BytesCompleted / 1024) & "K di " & CInt(e.BytesTotal / 1024) & "K scaricati - " & e.ProgressPercentage & "% completati." DownloadStatus.Text = progressText Me.ToolStripProgressBar1.Value = e.ProgressPercentage End Sub Sub ADUpdateAsync_UpdateCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles ADUpdateAsync.UpdateCompleted If (e.Cancelled) Then MessageBox.Show( "The update of the application's latest version was cancelled.") Exit Sub Else If (e.Error IsNot Nothing) Then MessageBox.Show( "ERROR: Could not install the latest version of the application. Reason: " + ControlChars.Lf + e.Error.Message + ControlChars.Lf + "Please report this error to the system administrator.") Exit Sub End If End If Dim dr As DialogResult = MessageBox.Show("L'applicazione รจ stata aggiornata con successo. Riavviare adesso? (Se non si dovesse riavviare adesso le modifiche avranno effetto al prossimo accesso.)", "DbConnect 2006", MessageBoxButtons.OKCancel) If (dr = System.Windows.Forms.DialogResult.OK) Then Application.Restart() End If End Sub | | Giuseppe Porcelli Tuesday, October 25, 2005 8:14 AM | I've been able to use CheckForUpdateAsync until last half an hour. Now, out of blue, It NEVER gets raised!!! Help help. | | manojamin Friday, November 18, 2005 7:27 PM | Hi Guys
Like above, CheckForUpdateCompleted is not being triggered in my main project, i created a very small app to test the update and it works fine, but when i copy the same code into my main project it doesn't get triggered.
Any ideas
Regards
Steve | | SLang Monday, September 17, 2007 11:30 AM |
|