using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller;
using MediaBrowser.Model.Logging;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
namespace MediaBrowser.WebDashboard.Api
{
///
/// Class DashboardInfoWebSocketListener
///
[Export(typeof(IWebSocketListener))]
class DashboardInfoWebSocketListener : BasePeriodicWebSocketListener
{
///
/// Gets the name.
///
/// The name.
protected override string Name
{
get { return "DashboardInfo"; }
}
///
/// The _kernel
///
private readonly Kernel _kernel;
///
/// Gets or sets the task manager.
///
/// The task manager.
private readonly ITaskManager _taskManager;
///
/// Initializes a new instance of the class.
///
/// The kernel.
/// The logger.
public DashboardInfoWebSocketListener(Kernel kernel, ILogger logger, ITaskManager taskManager)
: base(logger)
{
_kernel = kernel;
_taskManager = taskManager;
}
///
/// Gets the data to send.
///
/// The state.
/// Task{IEnumerable{TaskInfo}}.
protected override Task GetDataToSend(object state)
{
return Task.FromResult(DashboardService.GetDashboardInfo(_kernel, Logger, _taskManager));
}
}
}