Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return with event?

Status
Not open for further replies.

russland

Programmer
Jan 9, 2003
315
CH
Hi, I'm calling an assembly from my main WinForm. Now, that assembly is loading a file (DownloadFileGroupAsync("myFile")) in async mode. There is an eventhandler that would scream on completion of the download. Since I must return the instance to the main WinForm I wonder how I could make my method (in the invoked assembly) wait for that download to complete. How do I use the "Completed"-event in conjunction with the return.

I hope I made myself clear. The "Completed"-event should be the trigger for the invoked method to return the file to the main WinForm.

Any clue how I could bind that event to the return?

Any hint highl apperciated. Thanks
 
Normally,

you would make a call to download the file and attach to the completed event.

If you want to get the file path you could do that with a custom event delegate that includes the path (if you have access to the component doing the download)

example:

public delegate void CompletedEventHandler(object sender, string filepath);

Then you create your custom event:

public event CompletedEventHandler downloadcomplete;

Hope that gets you started
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top