Encapsulating C# GUI components in a DLL

I am charged with designing a system composed of 1) a GUI that handles communication with a device and 2) DLLs that represent modes in which the device will operate.

Each mode requires different configuration details so the idea is to have each DLL contain a method to produce a control-filled panel that can be placed in the GUI.

My work in C# up to now has been a bit less involved and I'm not sure how to implement this kind of functionality. I have not been successful in locating help or examples of this kind of implementation. Can someone point me in the right direction?

Answers


You will need a base dll that has your interfaces and base classes. The other dll's will then reference that base dll and extend/derive/implement those base classes/interfaces.

For example, if you have a dll (Base.dll) that has an interface like:

public interface CoolGui {
  void DrawGui(Graphics g); 
}

Then your other two dll's (One.dll and Two.dll) will reference Base.dll and implement CoolGui in their UI.

EDIT:

And of course, you will need to load in your dll's dynamically and use reflection to get the correct instances of your interface/base class. Here's a codeproject article to help: http://www.codeproject.com/KB/cs/DynLoadClassInvokeMethod.aspx


Need Your Help

Issue using common blocks in Fortran

fortran fortran-common-block

I'm working with fortran subroutines of a finite element analysis program. I have to share variables between the two subroutines so I'm using COMMON blocks (EDIT: module is better). The problem is ...

ListView databinding to list of string arrays

c# wpf listview gridview data-binding

I saw many examples online, about how to realize databinding to an objects attribute. Most people did it by adding the attribute DisplayMemberBinding="{Binding Date}" to a GridViewColumn.