what is best pratice doing this?

J

Jeff

Hey

I'm about to start developing an windows application based on .net 2.0.

The GUI will consist of 2 things: a treeview and an area displaying things
based on selections in the treeview. The treeview shows all the modules in
the application and gives easy access to each module...

Lets say I today have 5 modules I want to include in this application. But
some day in the future I may have more modules in the application....

So I was wondering if there is possible to develop the GUI for this
application and then add the modules to the program. So I in the application
can register new modules and then the treeview will show all added module
and display windows belonging to those modules... - And also I want to be
able to remove a module from the application...

The goal is to split the modules from the GUI... I think it's not a good
idea to have the modules codes together with the GUI....

Would be great if I could develop each module into it's own assembly and in
the window applicatioin I could choose to register the module and the module
gets available in the application...

I'm wondering what is the best practice doing this?

If you have links about this subject, then please post them :)

Jeff
 
A

Alberto Poblacion

Jeff said:
I'm about to start developing an windows application based on .net 2.0.

The GUI will consist of 2 things: a treeview and an area displaying things
based on selections in the treeview. The treeview shows all the modules in
the application and gives easy access to each module...

Lets say I today have 5 modules I want to include in this application. But
some day in the future I may have more modules in the application....

So I was wondering if there is possible to develop the GUI for this
application and then add the modules to the program. So I in the
application can register new modules and then the treeview will show all
added module and display windows belonging to those modules... - And also
I want to be able to remove a module from the application...

The goal is to split the modules from the GUI... I think it's not a good
idea to have the modules codes together with the GUI....

Would be great if I could develop each module into it's own assembly and
in the window applicatioin I could choose to register the module and the
module gets available in the application...


It shouldn't be too hard to do. Compile each of your modules into a
separate dll. Make each of them inherit from the same base class, or
implement an interface that is common to all of them. This base class or
interface will have methods such as GetTextToDisplayInTreeView or
ShowModuleInterfaceOnScreen.
The main program (the part with the treeview) can keep a list of
installed modules (which could be as simple as enumerating all the DLLs that
you have copied into a specific folder). For each of them, it would use
Reflection to load the assembly and create an instance of the main class
inside, then cast it to the base class or interface, and call the methods
that we defined previously to display whatever is needed in the tree and
show the interface on screen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top