jellyfin-server/MediaBrowser.WebDashboard/Api/DashboardInfoWebSocketListener.cs

59 lines
1.8 KiB
C#
Raw Normal View History

2013-02-21 01:33:05 +00:00
using MediaBrowser.Common.Kernel;
2013-02-23 07:57:11 +00:00
using MediaBrowser.Common.ScheduledTasks;
2013-02-21 01:33:05 +00:00
using MediaBrowser.Controller;
2013-02-21 20:26:35 +00:00
using MediaBrowser.Model.Logging;
2013-02-21 01:33:05 +00:00
using System.ComponentModel.Composition;
using System.Threading.Tasks;
namespace MediaBrowser.WebDashboard.Api
{
/// <summary>
/// Class DashboardInfoWebSocketListener
/// </summary>
[Export(typeof(IWebSocketListener))]
2013-02-22 15:16:48 +00:00
class DashboardInfoWebSocketListener : BasePeriodicWebSocketListener<DashboardInfo, object>
2013-02-21 01:33:05 +00:00
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
protected override string Name
{
get { return "DashboardInfo"; }
}
2013-02-22 15:16:48 +00:00
/// <summary>
/// The _kernel
/// </summary>
private readonly Kernel _kernel;
2013-02-23 07:57:11 +00:00
/// <summary>
/// Gets or sets the task manager.
/// </summary>
/// <value>The task manager.</value>
private readonly ITaskManager _taskManager;
2013-02-21 20:26:35 +00:00
/// <summary>
/// Initializes a new instance of the <see cref="DashboardInfoWebSocketListener" /> class.
/// </summary>
2013-02-22 15:16:48 +00:00
/// <param name="kernel">The kernel.</param>
2013-02-21 20:26:35 +00:00
/// <param name="logger">The logger.</param>
2013-02-23 07:57:11 +00:00
public DashboardInfoWebSocketListener(Kernel kernel, ILogger logger, ITaskManager taskManager)
2013-02-21 20:26:35 +00:00
: base(logger)
{
2013-02-22 15:16:48 +00:00
_kernel = kernel;
2013-02-23 07:57:11 +00:00
_taskManager = taskManager;
2013-02-21 20:26:35 +00:00
}
2013-02-21 01:33:05 +00:00
/// <summary>
/// Gets the data to send.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>Task{IEnumerable{TaskInfo}}.</returns>
protected override Task<DashboardInfo> GetDataToSend(object state)
{
2013-02-23 07:57:11 +00:00
return Task.FromResult(DashboardService.GetDashboardInfo(_kernel, Logger, _taskManager));
2013-02-21 01:33:05 +00:00
}
}
}