Search Results

Search found 1 results on 1 pages for 'laurus schluep'.

Page 1/1 | 1 

  • C# and WUAPI: BeginDownload function

    - by Laurus Schluep
    first things first: I have no experience in object-oriented programming, whatsoever. I created my share of VB scripts and a bit of Java in school, but that's it. So my problem most likely lies there. But nevertheless, for the past few days, I've been trying to get a little application together that allows me to scan for, select and install Windows updates. So far I've been able to understand most of the reference and with the help of a few posts around the internet and I'm now at the point where I can select and download updates. So far I've been able to download a collection of updates using the following code: UpdateCollection CurrentInstallCollection = (UpdateCollection)e.Argument; UpdateDownloader CurrentDownloader = CurrentSession.CreateUpdateDownloader(); CurrentDownloader.Updates = CurrentInstallCollection; This is run in a background worker and returns once the download is done. It works just fine, I can see the updates getting downloaded on the file system but there isn't really a way to display the progress within the application. To do such a thing, there is the IDownloadJob interface that allows me to use the .BeginDownload method of the downloader (UpdateSession.CreateUpdateDownloader)...i think, at least. :D And here comes the problem: I have now tried for about 6 hours to get the code working, but no matter what I tried nothing worked. Also, there isn't much information around on the internet about the .BeginDownload method (or at least it seems that way), but my call of the method doesn't work: IDownloadJob CurrentDownloadJob = CurrentDownloader.BeginDownload(); I have no clue what arguments to supply...I've tried methods, objects...to no avail. The complete block of code looks like this: UpdateCollection CurrentInstallCollection = (UpdateCollection)e.Argument; UpdateDownloader CurrentDownloader = CurrentSession.CreateUpdateDownloader(); CurrentDownloader.Updates = CurrentInstallCollection; IDownloadJob CurrentDownloadJob = CurrentDownloader.BeginDownload(); IDownloadProgress CurrentJobProgess = CurrentDownloadJob.GetProgress(); tbStatus.Text = Convert.ToString(CurrentJobProgess.PercentComplete); I've found one source on the internet that called the method with .BeginDownload(this,this,this), which does not report any error in the code editor but probably won't help with reporting as it is my understanding, that the arguments supplied are the methods that are called when the described event occurrs (progress has changed or the download has finished). I also tried this, but it didn't work either: http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/636a8399-2bc1-46ff-94df-a58cebfe688c A detailed description of the BeginDownload method: http://msdn.microsoft.com/en-us/library/aa386132(v=VS.85).aspx WUAPI Reference: Unfortunately I'm not allowed to post the link, but the link to the BeginDownload method goes to the same place. :) I know, it's quite a bit to ask, but if someone could point me in the right direction (as in which arguments to pass and how), it'd be very much appreciated! :)

    Read the article

1