|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
UserControl, GUI inside the application on runing time, PlugIn problemI 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 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, 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 Good morning Stanimir,
thanks for your help. Show quoteHide quote > My main problem is the user control.> 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 >> 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 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
Other interesting topics
Compare Values
Convert doc, xls, pdf, rtf to plain Text (string) - I will pay for .NET Dllimport System AccessViolationExecption Check extension what does this statement double? pPlanMinimum; mean? Filewatcher - what happens if a file is created while processing another one? validating xml file methods Range Validator Scrolling text for messages. |
|||||||||||||||||||||||