jellyfin/MediaBrowser.WebDashboard/Api/DashboardInfoWebSocketListener.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2013-02-21 01:33:05 +00:00
using MediaBrowser.Common.Kernel;
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))]
class DashboardInfoWebSocketListener : BasePeriodicWebSocketListener<IKernel, DashboardInfo, object>
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
protected override string Name
{
get { return "DashboardInfo"; }
}
2013-02-21 20:26:35 +00:00
/// <summary>
/// Initializes a new instance of the <see cref="DashboardInfoWebSocketListener" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
[ImportingConstructor]
public DashboardInfoWebSocketListener([Import("logger")] ILogger logger)
: base(logger)
{
}
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)
{
return Task.FromResult(DashboardService.GetDashboardInfo((Kernel)Kernel));
}
}
}