using MediaBrowser.Common.Net;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
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"; }
}
private readonly IServerApplicationHost _appHost;
///
/// Gets or sets the task manager.
///
/// The task manager.
private readonly ITaskManager _taskManager;
///
/// The _user manager
///
private readonly IUserManager _userManager;
private readonly ILibraryManager _libraryManager;
///
/// Initializes a new instance of the class.
///
/// The logger.
/// The task manager.
/// The user manager.
public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, ILibraryManager libraryManager)
: base(logger)
{
_appHost = appHost;
_taskManager = taskManager;
_userManager = userManager;
_libraryManager = libraryManager;
}
///
/// Gets the data to send.
///
/// The state.
/// Task{IEnumerable{TaskInfo}}.
protected override Task GetDataToSend(object state)
{
return DashboardService.GetDashboardInfo(_appHost, Logger, _taskManager, _userManager, _libraryManager);
}
}
}