Plugin "communication"

Discussion in 'General Development (no feature request here!)' started by GetWell, August 2, 2012.

  1. GetWell

    GetWell Portal Pro

    Joined:
    October 4, 2006
    Messages:
    205
    Likes Received:
    32
    Gender:
    Male
    Ratings:
    +32 / 0
    Home Country:
    Denmark Denmark
    I have been build the NotificationBar plugin which should be able for all other plugins to use.

    But now im stuck with an "error"/understanding issue.

    When a plugin developer uses the NotificationBar plugin like this (references the NotificationBar.dll file):
    Code (Text):
    1. public class ProgressBarExample
    2.     {
    3.         MPNotificationBar.INotification _Notification;
    4.  
    5.         public ProgressBarExample()
    6.         {
    7.             //Add notification to NotificationBarManager
    8.             _Notification = MPNotificationBar.NotificationBarManager.AddNotification(111111, "Downloading...", MPNotificationBar.NotificationBarManager.Types.Information, true, true);
    9.         }
    10. }
    This will work fine when NotificationBar plugin is installed, but will crash at the AddNotification line if not installed.



    Is it possible (how?) to make the plugin to skip this if notificationbar not installed?
    OR is there a better way to develop this kind of "communication" with dll which may/may not exists?

    I hope you can help me finding a solution so it may be easier for other plugin developers :)
     
    Last edited: August 2, 2012
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. seco
    • Team MediaPortal

    seco Development Group

    Joined:
    August 7, 2007
    Messages:
    1,579
    Likes Received:
    897
    Gender:
    Male
    Ratings:
    +1,234 / 4
    Home Country:
    Finland Finland
    Show System Specs
    Last edited: August 2, 2012
  4. doskabouter
    • Premium Supporter

    doskabouter Community Plugin Dev

    Joined:
    September 27, 2009
    Messages:
    2,767
    Likes Received:
    734
    Location:
    Nuenen
    Ratings:
    +1,084 / 1
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Besides that, you have to be aware of the fact that if you call a method or class which uses a type that is in the not-installed assembly, that method will generate an exception. So my solution is to put all references to that assembly in separate (private) methods, and put a try/catch around the invocation of those methods
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!