2010-10-08 03:35:04 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2011-04-10 02:44:01 +00:00
|
|
|
|
using System.Linq;
|
2010-10-21 01:49:23 +00:00
|
|
|
|
using NzbDrone.Core.Model.Notification;
|
2010-10-08 03:35:04 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
|
{
|
2011-04-08 23:48:47 +00:00
|
|
|
|
public class NotificationProvider
|
2010-10-08 03:35:04 +00:00
|
|
|
|
{
|
2011-11-21 04:43:16 +00:00
|
|
|
|
private static ProgressNotification _currentNotification;
|
2010-10-08 03:35:04 +00:00
|
|
|
|
|
2011-11-21 04:43:16 +00:00
|
|
|
|
public virtual ProgressNotification GetCurrent()
|
2010-10-08 03:35:04 +00:00
|
|
|
|
{
|
2012-01-23 07:43:54 +00:00
|
|
|
|
if (_currentNotification == null || _currentNotification.CompletedTime < DateTime.Now.AddSeconds(-6))
|
2010-11-06 00:43:13 +00:00
|
|
|
|
{
|
2011-11-21 04:43:16 +00:00
|
|
|
|
return null;
|
2010-11-06 00:43:13 +00:00
|
|
|
|
}
|
2011-11-21 04:43:16 +00:00
|
|
|
|
|
|
|
|
|
return _currentNotification;
|
2010-10-08 03:35:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-10 02:44:01 +00:00
|
|
|
|
public virtual void Register(ProgressNotification notification)
|
|
|
|
|
{
|
2011-11-21 04:43:16 +00:00
|
|
|
|
_currentNotification = notification;
|
2011-04-10 02:44:01 +00:00
|
|
|
|
}
|
2010-10-08 03:35:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|