none
MEF - Manage list of all plugins in a plugin app RRS feed

  • Question

  • Hello!

    I am writing "simple" application to manage my plugin apps. My Manager recognizes 2 types of plugin
    a) UserApps
    b) SystemApps

    I am the author of all plugins. When application loads it reads all plugins (*.dll) from specific folder and builds a treeview
    with the following structure.

    Manager
      + User Apps
          - UserApp 1
          - UserApp 2
          - UserApp 3
      + System Apps
          - UserManager
          - Databases
          - AppManager [this is now a problem]  

    Each UserApp (SysApp also) is written in a way that
    - it reports its state (ide, running, failed)
    - has Heartbeat event to report progress (only while in running state)
    - is controllable by 2 commands (Start, Stop)

    I hope you get the idea.

    OK. The problem is that I need to access a list of all plugins loaded (inside a plugin app -> AppManager).

    In my Main form I have defined 2 properties like this:

    [ImportMany(typeof(ISystemPlugins))]
    public IEnumerable<ISystemPlugins> SystemPlugins { get; set; }
    
    [ImportMany(typeof(IApplicationPlugins))]
    public IEnumerable<IApplicationPlugins> AppPlugins { get; set; }

    I am building treeview from this 2 properties and keeping reference to each plugin in Node's Tag property.

    And now I am stuck, since I can't find a way to list all loaded plugins.
    I would like to add a gridview with  folowing columns (App name, State, Progressbar, Commands: start/stop).
    All this in AppManager plugin (SysApp)


    I think this approach smells like a bad design, but I am lost.

    I would appreciate if someone direct me to the right track again.

    Thanks



    Friday, May 19, 2017 6:03 AM

All replies

  • Hi forum-dv,

    >>And now I am stuck, since I can't find a way to list all loaded plugins.

    Maybe you could use a TreeView with Columns, And the following article provide a custom control for your reference.

    https://www.codeproject.com/Articles/23746/TreeView-with-Columns

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 22, 2017 5:42 AM
  • Hey,

    Thanks for showing interest.

    I plan to use TreeView with columns (DevExpress), but I expect same problem.
    I found out that my PluginState class works as expected (notifies all controls it is linked through binding source).

    But when it is part of the collection (list, array,...) and whole list is DataSource to bindingsource control.
    Then gridview (XtraGrid) is refreshed when I move cursor around (change active cell).

    It seems  the problem is that collection (list, array) doesn't re-trigger propertychanged event.

    Any ideas....

    Wednesday, May 24, 2017 9:30 PM
  • Hi forum-dv,

    >>It seems  the problem is that collection (list, array) doesn't re-trigger propertychanged event.

    What kind of project template you are using, WPF or winform, I would suggest that you could post your issue on related forum for suitable support.

    #Winform

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winforms

    #WPF

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 25, 2017 7:01 AM