Understanding WinformsInteraction demo

Oct 26, 2010 at 7:20 PM

Looking at the WinformsInteraction demo (under 02_Advanced), the XcoAppSpace is created in program.cs and then the space and the NotificationWorker are passed as parameters to the WinForms application as follows:

Application.Run(new Form1(space, w));

This obviously works, but is somewhat limiting.

If one wants to have a winforms app and a worker in seperate application spaces and not rely on parameter passing at startup for the WinForms application, what is the correct way of doing this?

Thank you.

Coordinator
Oct 29, 2010 at 9:06 AM
Edited Oct 29, 2010 at 9:06 AM

Hi,

In the WinForms interaction demo, the XcoAppSpace and Worker instances are created outside of the WinForm so that the WinForm itself doesn't need to bother with these activities itself. In a small demo application like this you could of course do this directly in your WinForm as well - but in a larger application you would probably have a structure where your GUI components don't have to deal with these things directly, and get the needed components injected.
But in the end of course this depends on your application and what is best suiting in your case, and there is no explicit "correct" way of doing this - but following principles like separation of concerns and dependency injection is always a good idea.

Thomas