Home All Groups Group Topic Archive Search About

UserControl, GUI inside the application on runing time, PlugIn problem

Author
12 Dec 2008 7:38 PM
Sandra Baum
Hello,

I search for a good example.

My idea:
     UserControl1  -- DLL1  -- with the red textbox
            Textbox1 ---  result = Textbox1 red
     UserControl2  -- DLL2  -- with the blue textbox
            Textbox1 ---  result = Textbox1 blue
     UserControl3  -- DLL3  -- need an additional textbox, however
            Textbox1 (white) + Textbox2 (white) ---  result = Textbox1 +
Textbox2

     Application  -- EXE

  UserControlXY -- Interface/Contract -- Application/Exe

In the folder Bin\Release looking for available DLL's
       DLL's - If we find more as one, we show also the versions in a
listbox

The user choose one of the Dll , the application is start up

Advantage
     New UserInterface, no changes in the EXE, only chnage the DLL

How can I do that?
IPlugin _plugin = (IPlugin) ....??????

Interface is similar the result.

result = textbox1 red
result = textbox1 blue
result = textbox1 white + textbox2 white

I use VS2005, C#

with best Sandra

Author
12 Dec 2008 9:15 PM
Stanimir Stoyanov
Hello Sandra,

Writing a plugin interface in C# is relative easy. Of course, you first have
to design it -- choose what the base functionality will be (it will be
common for all plugins). For example, your IPlugin interface must always
have a way of exposing the appropriate UserControl or a whole form to show.
You might also add a distinctive name and version as properties.

IPlugin has to be defined in a 'middle-man' assembly so that it is
referenced by both plugins, and your application. It will act as a link
between the two.

The loading part:
-- You can an array of the existing .DLL files using the System.IO.Directory
class
-- Each assembly that you have found can be loaded into the memory using
Reflection (System.Reflection.Assembly.LoadFile(...))
-- Walk through each assembly's class and check if the type implements your
IPlugin interface. If so, keep this class in a list of the eligible plugins.

You can then present the user with the various plugin options and create the
appropriate class. See the System.Activator.CreateInstance(...) method for
more information on instantiating types dynamically.

Divelements have a sample plugin architecture at
http://www.divil.co.uk/net/articles/plugins/plugins.asp. It is VB.NET-only
though.

Hope this helps,
--
Stanimir Stoyanov
http://stoyanoff.info

Show quoteHide quote
"Sandra Baum" <sb@noSpam.DE> wrote in message
news:uPsYnEJXJHA.552@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> I search for a good example.
>
> My idea:
>     UserControl1  -- DLL1  -- with the red textbox
>            Textbox1 ---  result = Textbox1 red
>     UserControl2  -- DLL2  -- with the blue textbox
>            Textbox1 ---  result = Textbox1 blue
>     UserControl3  -- DLL3  -- need an additional textbox, however
>            Textbox1 (white) + Textbox2 (white) ---  result = Textbox1 +
> Textbox2
>
>     Application  -- EXE
>
>  UserControlXY -- Interface/Contract -- Application/Exe
>
> In the folder Bin\Release looking for available DLL's
>       DLL's - If we find more as one, we show also the versions in a
> listbox
>
> The user choose one of the Dll , the application is start up
>
> Advantage
>     New UserInterface, no changes in the EXE, only chnage the DLL
>
> How can I do that?
> IPlugin _plugin = (IPlugin) ....??????
>
> Interface is similar the result.
>
> result = textbox1 red
> result = textbox1 blue
> result = textbox1 white + textbox2 white
>
> I use VS2005, C#
>
> with best Sandra
Are all your drivers up to date? click for free checkup

Author
13 Dec 2008 9:41 AM
Sandra Baum
Good morning Stanimir,

thanks for your help.


Show quoteHide quote
>
> Divelements have a sample plugin architecture at
> http://www.divil.co.uk/net/articles/plugins/plugins.asp. It is
> VB.NET-only though.
>
.....
>
...
...
>> I search for a good example.
>>
>> My idea:
>>     UserControl1  -- DLL1  -- with the red textbox
>>            Textbox1 ---  result = Textbox1 red
>>     UserControl2  -- DLL2  -- with the blue textbox
>>            Textbox1 ---  result = Textbox1 blue
>>     UserControl3  -- DLL3  -- need an additional textbox, however
>>            Textbox1 (white) + Textbox2 (white) ---  result = Textbox1 +
>> Textbox2
>>
My main problem is the user control.
If I use only  a class it is much more easier as a userinterface.
(usercontrol)
Maybe you have an example also with userinterface.

Thanks and have a nice weekend.


Regards Sandra
Author
14 Dec 2008 6:47 PM
Sandra Baum
Hello together,

have everbody a simple example with usercontrol in C#.

Thanks a lot and have a nice start in the new week.

  with best Sandra
Author
16 Dec 2008 8:11 PM
Sandra Baum
Hello together,

that is absolutely not simple.
  I hope, I doesn't fall on them annoys, but I need an example.
  I think that, anybody have must done it.
  It would be nice, if I got an answer again.
Have a nice week.

Regards Sandra

Bookmark and Share