using MediaBrowser.Common.Net; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Logging; using System.Threading.Tasks; namespace MediaBrowser.WebDashboard.Api { /// /// Class DashboardInfoWebSocketListener /// 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; private readonly ISessionManager _sessionManager; /// /// Initializes a new instance of the class. /// /// The app host. /// The logger. /// The task manager. /// The user manager. /// The library manager. public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, ILibraryManager libraryManager, ISessionManager sessionManager) : base(logger) { _appHost = appHost; _taskManager = taskManager; _userManager = userManager; _libraryManager = libraryManager; _sessionManager = sessionManager; } /// /// Gets the data to send. /// /// The state. /// Task{IEnumerable{TaskInfo}}. protected override Task GetDataToSend(object state) { return DashboardService.GetDashboardInfo(_appHost, Logger, _taskManager, _userManager, _libraryManager, _sessionManager); } } }