addon forms??

  • Thread starter Thread starter Raj Chudasama
  • Start date Start date
R

Raj Chudasama

I have a gui app in which i have various forms. I would like to make it so
these forms become sort of "add on" featuers. so you necessarily don t have
to iinclude the forms with the original exe but you can put them in the same
directory later on and have them loaded etc. how can i accomplish this? btw
this forms (as well as main gui) use socket connection(s) to a server.

please provide some ideas or suggestions.

thanks
 
Raj,

In order to do this, you would place your add-in components into a
well-known (to the app at least) directory for the app. Typically, this
would be a sub directory. Either that or you can specify the dll locations
in your .config file for the app.

Once you know where you want to get the plugins from, you can call the
Load method on the Assembly class to load the assemblies that contain the
types. You can then call GetType on the Assembly instance to get the Type
for your form, and then create it using the CreateInstance method on the
Activator class.

You can then cast the return result to Form, and use it. If you expect
all of these forms to expose some functionality, then I would make sure you
define an interface, and cast the form to that interface to query the form
for whatever it is you are trying to do.

Hope this helps.
 
OK what is this called in .Net? Addons? so i can search more doc using that
term
thanks

Nicholas Paldino said:
Raj,

In order to do this, you would place your add-in components into a
well-known (to the app at least) directory for the app. Typically, this
would be a sub directory. Either that or you can specify the dll
locations in your .config file for the app.

Once you know where you want to get the plugins from, you can call the
Load method on the Assembly class to load the assemblies that contain the
types. You can then call GetType on the Assembly instance to get the Type
for your form, and then create it using the CreateInstance method on the
Activator class.

You can then cast the return result to Form, and use it. If you expect
all of these forms to expose some functionality, then I would make sure
you define an interface, and cast the form to that interface to query the
form for whatever it is you are trying to do.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Raj Chudasama said:
I have a gui app in which i have various forms. I would like to make it
so these forms become sort of "add on" featuers. so you necessarily don t
have to iinclude the forms with the original exe but you can put them in
the same directory later on and have them loaded etc. how can i accomplish
this? btw this forms (as well as main gui) use socket connection(s) to a
server.

please provide some ideas or suggestions.

thanks
 
Raj,

There isn't anything out of the box in .NET which can help with this.
Hopefully, in the future, MS will come up with something, since a lot of
people are rolling their own right now.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Raj Chudasama said:
OK what is this called in .Net? Addons? so i can search more doc using
that term
thanks

Nicholas Paldino said:
Raj,

In order to do this, you would place your add-in components into a
well-known (to the app at least) directory for the app. Typically, this
would be a sub directory. Either that or you can specify the dll
locations in your .config file for the app.

Once you know where you want to get the plugins from, you can call the
Load method on the Assembly class to load the assemblies that contain the
types. You can then call GetType on the Assembly instance to get the
Type for your form, and then create it using the CreateInstance method on
the Activator class.

You can then cast the return result to Form, and use it. If you
expect all of these forms to expose some functionality, then I would make
sure you define an interface, and cast the form to that interface to
query the form for whatever it is you are trying to do.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Raj Chudasama said:
I have a gui app in which i have various forms. I would like to make it
so these forms become sort of "add on" featuers. so you necessarily don
t have to iinclude the forms with the original exe but you can put them
in the same directory later on and have them loaded etc. how can i
accomplish this? btw this forms (as well as main gui) use socket
connection(s) to a server.

please provide some ideas or suggestions.

thanks
 
Back
Top