My app is expanding, but the reqs dictate that there should be only one window open at all times, think of Nodepad where there is a menu, with each menu item different functionality but only one window open at all times as opposed to Excel where a user may have few windows open at once.
So in terms of Windows forms, I was thinking of placing a form within a main form. Then i could load an embedded form needed depending on the user menu choice. OR I could be adding controls to the main form (and their events dynamically depending on the user menu choice). I would use a presenter class for that.
That’s just two solution I would use. Do you guys have any tips/experience on how to do it better?
I realize now that I would have to re-write parts of my app, but let’s pretend i am starting from scratch.
Don’t embed Forms, it’s not what Forms are for. And it’s not necessary.
Put the UI of your modules/sections on UserControls. That keeps it nice and modular and you keep your options open: those UserControls can be directly embedded (1 at a time) in the MainForm or in MDI ChildWindows or in TabPages or …
Use a Base UserControl (Visual Inheritance) and/or a Interface to implement common functionality.