Plugin "communication" (1 Viewer)

GetWell

Portal Pro
October 4, 2006
205
32
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:
public class ProgressBarExample
    {
        MPNotificationBar.INotification _Notification;
 
        public ProgressBarExample()
        {
            //Add notification to NotificationBarManager
            _Notification = MPNotificationBar.NotificationBarManager.AddNotification(111111, "Downloading...", MPNotificationBar.NotificationBarManager.Types.Information, true, true);
        }
}
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:

doskabouter

Development Group
  • Team MediaPortal
  • September 27, 2009
    4,583
    2,972
    Nuenen
    Home Country
    Netherlands Netherlands
    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
     

    Users who are viewing this thread

    Top Bottom