I want to build an application in C#, using the MVC pattern. I want first to create an instance of my controller and pass it a form as a parameter.
Here is the normal C# way (default):
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new mainForm(new Controller()));
}
The problem with this is that I don't want my mainForm class be able to access the Controller. I just want the controller to "see" the other objects.
I want something like this:
static void Main()
{
Controller cnt = new Controller(new mainForm());
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(cnt);
}
This doesn't work though, because the method Run takes either a Form as an argument or an ApplicationContent. How can I do this?