Wiki Navigation
- Loading...
Description
This plugin provides a global NotificationBar.
The idea
The idea is to give the same kind of notifications as we know it from Smartphones.
That gives you some opportunities fore example:
- Start update all your plugins in the background and get at notification when its done (or with a progress bar)
- Get a notification when your favorite show starts
- Get a warning if MP can't connect to the TV-server
- etc
Note! - These thing mentioned above is not a part of this plugin, but its a can be if the developers of above decide to implement the NotificationBar functionality.
Developers
Plugin ID: 99207
Requered: Make a reference to MPNotificationBar.dll
Notification creation examples
Here are examples of different ways for notification creation:
public void ShowNotifications()
{
//Method 1 - Without ProgressBar
MPNotificationBar.Notification notification = new MPNotificationBar.Notification(_MyPluginID, "This is a test message", MPNotificationBar.NotificationBarManager.Types.Information);
MPNotificationBar.NotificationBarManager.AddNotification(notification);
//Method 2 - Without ProgressBar
MPNotificationBar.NotificationBarManager.AddNotification(_MyPluginID, "This is a test message", MPNotificationBar.NotificationBarManager.Types.Information);
//Method 3 - With ProgressBar
MPNotificationBar.NotificationBarManager.AddNotification(_MyPluginID, "This is a test message", MPNotificationBar.NotificationBarManager.Types.Information, true);
}
INotification interface
public interface INotification
{
/// <summary>
/// Gets/sets notification id
/// </summary>
int NotificationID { get; set; }
/// <summary>
/// Gets/sets text to display
/// </summary>
/// <returns>string</returns>
string Text { get; set; }
/// <summary>
/// Gets/sets progress (0-100)
/// </summary>
/// <returns>Int16</returns>
Int16 Progress { get; set; }
/// <summary>
/// Gets/sets plugin id
/// </summary>
/// <returns>Int32</returns>
Int32 PluginID { get; set; }
/// <summary>
/// Gets/sets value indicating if notification uses progressbar
/// </summary>
/// <returns>Boolean</returns>
Boolean IsUsingProgressBar { get; set; }
/// <summary>
/// Gets/sets value indicating if notification shall be removed
/// </summary>
/// <returns>Boolean</returns>
Boolean Remove { get; set; }
/// <summary>
/// Tells notification that it has been shown
/// </summary>
void NotificationShowed();
/// <summary>
/// Gets/sets notification type
/// </summary>
/// <returns>MPNotificationBar.NotificationBarManager.Types</returns>
MPNotificationBar.NotificationBarManager.Types NotificationType { get; set; }
/// <summary>
/// Progress Changed event
/// </summary>
event EventHandler ProgressChanged;
/// <summary>
/// Content Changed event
/// </summary>
event EventHandler ContentChanged;
/// <summary>
/// Gets/sets SecondsToLive
/// </summary>
/// <returns>int</returns>
int SecondsToLive { get; set; }
}
Plugin example
//MyPlugin class
public class MyPlugin : GUIWindow, ISetupForm
{
const int _windowID = 0; // WindowID of windowplugin belonging to this setup. Enter your own unique code
System.Timers.Timer t = new System.Timers.Timer(15000);
MPNotificationBar.INotification notification;
public MyPlugin()
{
//Start ProgressBar Example
ProgressBarExample _ProgressBarExample = new ProgressBarExample();
//Start TimeoutMessage Example
TimeoutMessageExample _TimeoutMessageExample = new TimeoutMessageExample();
}
#ISetupForm Members
//See plugin guide what to implement here
}
public class TimeoutMessageExample
{
Int32 _PluginID = 0;
Int16 _SecondsToLive = 30; //seconds
public TimeoutMessageExample()
{
//Add notification to NotificationBarManager
MPNotificationBar.INotification _Notification = MPNotificationBar.NotificationBarManager.AddNotification(_PluginID, "This will disappear in " + _SecondsToLive + " seconds...", MPNotificationBar.NotificationBarManager.Types.Information);
_Notification.SecondsToLive = _SecondsToLive;
}
}
public class ProgressBarExample
{
Int32 _PluginID = 0;
System.Timers.Timer _DownloadTimer;
MPNotificationBar.INotification _Notification;
public ProgressBarExample()
{
//Add notification to NotificationBarManager
_Notification = MPNotificationBar.NotificationBarManager.AddNotification(_PluginID, "Downloading...", MPNotificationBar.NotificationBarManager.Types.Information, true);
//Emulate a download progress stepping 1% every second
_DownloadTimer = new System.Timers.Timer(1000);
_DownloadTimer.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);
_DownloadTimer.Enabled = true;
_DownloadTimer.Start();
}
void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//Step 1%
_Notification.Progress++;
//If download is finished -> mark notification for removal
if (_Notification.Progress > 100)
{
_Notification.Remove = true;
_DownloadTimer.Stop();
}
}
}

This page has no comments.