How can I get now downloading patches? The problem is: I sta开发者_如何学Pythonrt download and close my application, and when I start it I need to know what is going on there.
I aready found approach. I save the list of update ids in registry, and on start application reed from registry, start download for its like that
IUpdateSearcher updateSearcher = updateSession.CreateUpdateSearcher(); ISearchResult searchResult = updateSearcher.Search("IsInstalled = 0");var updateCollection = new UpdateCollection();
for (int i = 0; i < searchResult.Updates.Count; i++) { IUpdate update = searchResult.Updates[i]; //update id from registry if (update.Identity.UpdateID == "081cab8e-faf5-421b-be7c-3e796837f1ff") { updateCollection.Add(update); break; } } downloader = updateSession.CreateUpdateDownloader(); downloader.Updates = updateCollection; var downloadJob = downloader.BeginDownload(new DownloadProgress(), new DownloadCompleted(), this); var progress = downloadJob.GetProgress();
and in var progress
I cat get what updates now downloading and its progress
精彩评论