What is the Best Design for Customizable Forms?
I am developing a software which must be used for different organizations so some forms must be specially customized for the specific organization. For instance window "A" with datagrid "D" in it, is common for all organizations but each one needs different columns to be visible or collapsed. All windows in the software extend a "WindowBase" class. There is also a setting table in the database which shows software has been installed for which organization.
I can handle this issue by switching on the value retrieved from setting table but the code doesn't look neat and well developed.
I am looking forward to your instructions and i also appreciate that in advance :) .
Amin Amin, Nov 14, 2012
Windows form UserControls are the best fit, expose public properties to set it from the containing windows Forms.
Your UserControls should be in a common layer, should be added to each separate Solutions you create for different clients. Creating individual solutions per clients, help you not to expose client specific feature to each other.
Anything common across clients should be in common layer.
coming to your question: the containing form (the one which contains the user control) can set properties, based on which [in your case] could expose grid columns.
Reading the setting table should be in Common layer , which can receive ClientName (for instance) as parameter and return the info.
please let me know if you need more help.
Tarriq Ferrose Khan, Jun 18, 2013
There are various ways and each has its merits and demerits, If you don't mind sharing your boiler plate code, a better response could be provided as this is a very broad question.
Since you already have a working code, the members may be in a position to recommend or suggest possible refactoring if needed.
What piece of code bothers you and you are not happy with?
Rajesh Pillai, Dec 19, 2012