I want to create a (WinForms) application which consists of multiple panels. For each panel, I want to be able to assign a .dll file:
Those .dll files should contain XNA games that should be rendered into the respective panel.
I can load those games with
var game = (Game)Activator.CreateInstance(System.Reflection.Assembly.LoadFrom(path).GetTypes()
.First(t => t.IsSubclassOf(typeof(Game))));
Now, I cannot use game.Run()
because it will start a second message loop.
Starting a new thread also fails because of InvalidOperationException
s concerning access to controls from another thread.
The tutorials I found on the web were only able to deal with a game I write myself and include it into the main application, but I want to be able to add other games, similar to plug-ins.
How can I make my WinForms application render those XNA games, or is there a better solution to this?