Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp me please with writing a Plug-in in C# which exports it's on let say Config GUI
    primarykey
    data
    text
    <p>I am kind of new to C# .Net and I am enjoying the learning process! Right now I am working on a project (just to learn) in which plug-ins are the main key.</p> <p>I did the following till now which seems to work fine:</p> <p>Interface:</p> <pre><code>namespace My.test { public interface IMyPlugin { bool Execute(string Id, Object param); List&lt;string&gt; GetPluginIdList(); } } </code></pre> <p>a test plug-in implementing IMyPlugin Interface:</p> <pre><code>using System; .. .. using My.test; namespace demoplg { public class SamplePlugIn: IMyPlugin { public bool Execute(string Id, object param) { MessageBox.Show(Id, "SamplePlugIn"); return false; } public List&lt;string&gt; GetPluginIdList() { List&lt;string&gt; result = new List&lt;string&gt;(); result.Add("test1"); result.Add("test2"); return result; } } } </code></pre> <p>and in the main application (Host) I am using Reflections to load the Dll (assembly) and create an Instance of the plug-in.</p> <pre><code>try { Type[] types = PlugIn.GetTypes(); Type MyPlugInType = null; foreach (Type libtype in types) { //check if it implements the IMyPlugin. Type[] interfacelist = libtype.GetInterfaces(); foreach (Type lookupInf in interfacelist) { if (lookupInf.Name.Equals("IMyPlugin")) { MyPlugInType = libtype; break; } } if (MyPlugInType == null) continue; IMyPlugin xplg = null; ConstructorInfo ci = MyPlugInType.GetConstructor(new Type[] { }); xplg = ci.Invoke(null) as IMyPlugin; return xplg; } return null; } catch { return null; } </code></pre> <p>well, now what I want to have is, that a plug-in can have it's on configuration GUI, which I would like to add that in my Host (Main application) by calling something for example: xplg.RegisterPluginGUI(); </p> <p>Let say something in the form of a tree-view on the left side showing the name/description of the plug-in, and on the right side kind of a container where I can drop the UI of the plug-in on it.</p> <p>can some one please give some advice how to achieve this?</p> <p>Well, I've done something similar in Delphi which is not a very clean work ;-) Using WIN API to process the messages of a from inside a dll cached in the main form!!!</p> <p>Thanks in advance! AK</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload