Thursday, July 07, 2005

Using BITS from C#

Here is instructions download a file with BITS. Perhaps to update your app from C# or at least this will get you started. Bits is written in C++ but fourtounately; Microsoft wrote a wrapper called BackgroundCopyManager (backgroundcopymanager.dll). You can read the article and download the assembly here. You need to start a new C# project and add a reference to the dll and also add this namespace to the top of your code.
using Microsoft.Msdn.Samples.BITS;
Here is code to queue a file and download it.
Manager m = new Manager();
Job bj = m.CreateJob("MyJob3");
bj.AddFile("http://localhost/largefile.msi", "destination123.msi");
bj.ResumeJob();
This code will bind a listbox and show the status of each job
Manager myBITS = new Manager();
JobCollection myJobs = myBITS.GetListofJobs(JobType.AllUsers);
myListBox.DataSource = myJobs;
Good luck.

3 Comments:

At 3:10 AM, Anonymous Anonymous said...

I have encounted a problem while using Microsoft.Msdn.Samples.BITS.dll;you will not be able to clear jobs from myBITS.GetListofJobs().clear.It will return jobColleciton reference which can be set to null but the manager still have available jobs.

May be the wrapper is not written properly

 
At 10:45 PM, Anonymous Anonymous said...

You know ,I have some shadow of legend Gold, and my friend also has some
sol gold, do you kouw they have the same meaning,Both of them can be called
shadow of legend money,I just want to
buy shadow of legend Gold, because there are many
cheap shadow of legend Gold.

 
At 2:45 AM, Anonymous Anonymous said...

I know that most players use aion kina to get a shiny cool weapon like other players in game. You need enhance stones with aion online kina. The process of enhancing is simple if you have aion gold. You can buy aion kina after clicking enhance, you will see a star rotating about like roulette. The equipment will be enhanced to the next level if you have more cheap aion kina.

 

Post a Comment

<< Home