using MediaBrowser.Common.Kernel; 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; /// /// Initializes a new instance of the class. /// /// The kernel. /// The logger. [ImportingConstructor] public DashboardInfoWebSocketListener([Import("kernel")] Kernel kernel, [Import("logger")] ILogger logger) : base(logger) { _kernel = kernel; } /// /// Gets the data to send. /// /// The state. /// Task{IEnumerable{TaskInfo}}. protected override Task GetDataToSend(object state) { return Task.FromResult(DashboardService.GetDashboardInfo(_kernel, Logger)); } } }