For the last two to three months iv’e been dipping and diving in and out C# and WinForms but recently I will be starting a project that will help be learn more about real life issues when programming in .NET
I’m Mainly a web based programmer working with PHP, MySql, Unix, etc and when I create a website I like to have a concrete framework that would deal with things such as:
- Error Handling
- Input / Output
- Libraries
- Application Structure
- Database / Model abstraction
- Resource monitoring
There’s a few more to go in that list but ill keep it short.
So when im in C# I realise that when the application loads we run directly run the main form, which to me, makes you force logic for windows / forms within the Main Form/
Personally I might be wrong, and this is how it should be done, but I really do not think so, I wish to make a set of classes that control the the “Application Process” as such, this base system would control the instantiation and disposing of forms, Threading etc.
So when Application.run() fires up my application I want it to start an object called System and this object then would Parse Settings Files, Registry keys, Meta Information (CPU,Ram etc), Debugger, Switch Detection etc.
Then it would process the information and depending on the different entities effecting the application load we would run a form passing information to that form.
Within that form, If the A user clicks File > Options Then it would Ask the system to load the Options Form, , The System class would then load the Options Form passing in required information.
If that form needs to de thread it would as the System Base if it can place it within a new thread for me, And monitor it until its complete.
What would be a good example of building a system that works like this, and do you guys have any advice on how I should go about it.
Also any really good examples,books,articles of building an MVC architecture within the C# language would also be a plus.
Please enlighten me on this subject.
Robert,
if you build a new Windows App using Visual Studio you will definitely get the main form as the first screen shown, but it does not need to be like this.
Visual Studio does this for you. It creates a Program class (Program.cs) with the Main method (which is the entry point for you application, pretty much like any other language) and call the main form for you.
Look for Program.cs and you will find this:
static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } }Knowing this you can change it and do pretty much whatever you want to change the way forms are handled by your app.