Download percent complete

I am thinking about putting an icon in the notification tray that shows the download percent complete when the user hovers over it. Where do I get the percent complete from? I have seen overall progress, but I can't seem to find it just for the download. I would think it is available since the auto updater itself shows the progress.

I'm not sitting in front of the source code tight now, but I believe ProgressChanged event shows the per-step process. I'll look into this.

One other question along these lines - if the user exits the application before the update is complete, what do I check to say the dowload has started (and needs to resume) so I don't ask again if the want to download? Right now I am getting an ObjectDisposed exception which I am sure is because I am not handling the cancelling of the download correctly. But when I start my application back up again it sees "Update Available" as the status and tries to do it again, which it should not.

I'm not quite sure what you're asking. Are you saying your cancelling the AutomaticUpdater and you're getting an exception? What step is it on, what exception do you get (please list the full exception), and what function are you calling?

I guess my problem is in my understanding of what I want to do.

I want to put the download percent complete onto an icon in the notification tray so the auto updater icon will not be visible. If the user exists the application before the download is complete, I assume the download should restart, and my icon will show the correct percent complete until the updates are ready for install. I still want to have the user exit the application in order to do the install (like the automatic update setting does).

So right now I have a ForceCheckForUpdates call when my main form opens, then I was using the UpdateAvailable event to prompt the user that there are updates (for now it is just a message without a cancel option). After that things seem to not be working the way I expect. If I close the application before the update is done and I go back into the app, I get the UpdateAvailable event twice, which then attempts to do the InstallNow twice which causes the application to abort. Why does this get triggered twice?

Is there some code somewhere that gives examples of how to do what I am attempting? Basically I want to show the user the status of the download when updates are available.

I also am still trying to figure out how to clean out the update in my debug environment. I have tried just replacing the client file as previously suggested, but that does not work. What do I need to replace/remove so that my application does not think it is updated?

Since I have not been able to "reset" my debug application, I have not been able to get the exception I previously asked about, so right now I do not have more details about it.

After doing a bit of tweaking, I was able to get the exception again. When I attempted to quit the application while the update was downloading, I got "ObjectDisposedException was unhandled". It indicated that my main window was disposed to it could not continue (since I just closed it). Looking at the stack trace, the first non-windows module listed was auBackend_ProgressChanged. It almost seems like the updater kept processing after the application quit (I guess since it is async that might happen?).

When I attempt to recover after this I get the UpdateAvailable status twice which is causing another exception when InstallNow is called a second time. Shouldn't the status change to DownloadingUpdate? I still want the download to happen in the background, so I don't want to do the download sync'ed.

After some testing, I see that the percent complete does come as a parameter in the ProgressChanged event. This gives me what I wanted for the progress display on my icon. 🙂

I do have other questions now. I have removed the UpdateAvailable event since it gives me errors if the user closes the application before the udpate has completely downloaded. Is there some generic event where I can check the UpdateStepOn to see if the downloads are ready for install, etc? I have the ProgressChanged event, but in the case where the updates are found but not downloaded yet I am not getting the ProgressChanged event (I assume since the process really has not started). Also, if the download is complete and the user starts the application again to install them, do I still call InstallNow to complete the install or is there a different method I should use? And, going back to the exception I get when I close the app during the download, which event do I handle this exception in? I am not getting the Cancelled event (which I guess is not the right one since it is more interupted instead of cancelled).

I have also been looking at some of the wyupdate code and see that there is an ExtractFailed event, but I don't see it as part of the autoupdater's events. One thing I am noticing is that when I do exit the app during the download and I restart it, I get that the extract failed (since the download is not complete I assume) but I can't seem to trap that.

UpdateAvailable event since it gives me errors if the user closes the application before the udpate has completely downloaded.

I'll look into this.

And, going back to the exception I get when I close the app during the download, which event do I handle this exception in?

You shouldn't get an exception, but please Copy & paste the full stack trace so I track this down.

I have the ProgressChanged event, but in the case where the updates are found but not downloaded yet I am not getting the ProgressChanged event (I assume since the process really has not started).

Use the UpdateAvailable event. See a full list of events here: AutomaticUpdater Members.

Thanks for all the help and advice. I have eliminated most of my problems (I think) except the exception when I close my application during the download process. The other half of this is that when I restart the application it gets the ReadyToInstall event (which it is not) so when I call InstallNow it gives me an error (in the autoupdater icon) that it cannot extract the update (makes sense since the update did not finish). I am sure that once we solve the download continuation problem the extract error will no longer be an issue.

Here is the stack trace for the error:

at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous) at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args) at wyDay.Controls.AutomaticUpdater.auBackend_ProgressChanged(Object sender, Int32 progress) at wyDay.Controls.AutomaticUpdaterBackend.updateHelper_ProgressChanged(Object sender, UpdateHelperData e) at wyDay.Controls.UpdateHelper.ProcessReceivedMessage(UpdateHelperData data) at wyDay.Controls.UpdateHelper.SafeProcessReceivedMessage(Byte[] message) at wyDay.Controls.PipeClient.Read() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()