2023-01-22 22:15:55 +00:00
|
|
|
@page "/now"
|
|
|
|
@using Selector.SignalR;
|
2023-01-27 23:31:32 +00:00
|
|
|
@using System.Linq;
|
2023-01-23 18:11:37 +00:00
|
|
|
@implements IDisposable
|
2023-01-22 22:15:55 +00:00
|
|
|
|
2023-01-28 18:55:59 +00:00
|
|
|
<h1 class="text-center">Now</h1>
|
2023-01-22 22:15:55 +00:00
|
|
|
|
2023-01-28 18:55:59 +00:00
|
|
|
<div class="app text-center">
|
2023-01-23 18:11:37 +00:00
|
|
|
|
2023-01-27 23:31:32 +00:00
|
|
|
<NowPlayingCard Track="@nowCache.LastPlaying?.Track" Episode="@nowCache.LastPlaying?.Episode" />
|
|
|
|
<PlayCountCard Track="@nowCache.LastPlaying?.Track" Count="@nowCache.LastPlayCount" Username="@nowCache.LastPlayCount?.Username" />
|
|
|
|
|
2023-01-28 18:55:59 +00:00
|
|
|
@if (nowCache.LastPlayCount?.AlbumCountData?.Count() > 3)
|
2023-01-27 23:31:32 +00:00
|
|
|
{
|
|
|
|
<div class="chart-card card">
|
|
|
|
<RadzenChart>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLineSeries Smooth="@smooth" Data="@nowCache.LastPlayCount.ArtistCountData" CategoryProperty="TimeStamp" Title="Artist" ValueProperty="Value" Stroke="#598556" StrokeWidth="@strokeWidth">
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
|
|
|
</RadzenLineSeries>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLineSeries Smooth="@smooth" Data="@nowCache.LastPlayCount.AlbumCountData" CategoryProperty="TimeStamp" Title="Album" ValueProperty="Value" Stroke="#a34c77" StrokeWidth="@strokeWidth">
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
|
|
|
</RadzenLineSeries>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLineSeries Smooth="@smooth" Data="@nowCache.LastPlayCount.TrackCountData" CategoryProperty="TimeStamp" Title="Track" ValueProperty="Value" Stroke="#7a99c2" StrokeWidth="@strokeWidth">
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
|
|
|
</RadzenLineSeries>
|
|
|
|
<RadzenValueAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenValueAxis>
|
|
|
|
<RadzenCategoryAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenCategoryAxis>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLegend Position="LegendPosition.Bottom" />
|
2023-01-27 23:31:32 +00:00
|
|
|
</RadzenChart>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
@if (nowCache.LastPlayCount?.TrackCountData?.Count() > 3)
|
|
|
|
{
|
|
|
|
<div class="chart-card card">
|
2023-01-28 18:55:59 +00:00
|
|
|
<h2>Track History</h2>
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenChart>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLineSeries Smooth="@smooth" Data="@nowCache.LastPlayCount.TrackCountData" CategoryProperty="TimeStamp" Title="Track" ValueProperty="Value" Stroke="#7a99c2" StrokeWidth="@strokeWidth">
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
|
|
|
</RadzenLineSeries>
|
|
|
|
<RadzenValueAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenValueAxis>
|
|
|
|
<RadzenCategoryAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenCategoryAxis>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLegend Visible="false" />
|
2023-01-27 23:31:32 +00:00
|
|
|
</RadzenChart>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
@if (nowCache.LastPlayCount?.AlbumCountData?.Count() > 3)
|
|
|
|
{
|
|
|
|
<div class="chart-card card">
|
2023-01-28 18:55:59 +00:00
|
|
|
<h2>Album History</h2>
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenChart>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLineSeries Smooth="@smooth" Data="@nowCache.LastPlayCount.AlbumCountData" CategoryProperty="TimeStamp" Title="Album" ValueProperty="Value" Stroke="#a34c77" StrokeWidth="@strokeWidth">
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
|
|
|
</RadzenLineSeries>
|
|
|
|
<RadzenValueAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenValueAxis>
|
|
|
|
<RadzenCategoryAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenCategoryAxis>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLegend Visible="false" />
|
2023-01-27 23:31:32 +00:00
|
|
|
</RadzenChart>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
@if (nowCache.LastPlayCount?.ArtistCountData?.Count() > 3)
|
|
|
|
{
|
|
|
|
<div class="chart-card card">
|
2023-01-28 18:55:59 +00:00
|
|
|
<h2>Artist History</h2>
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenChart>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLineSeries Smooth="@smooth" Data="@nowCache.LastPlayCount.ArtistCountData" CategoryProperty="TimeStamp" Title="Artist" ValueProperty="Value" Stroke="#598556" StrokeWidth="@strokeWidth">
|
2023-01-27 23:31:32 +00:00
|
|
|
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
|
|
|
</RadzenLineSeries>
|
|
|
|
<RadzenValueAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenValueAxis>
|
|
|
|
<RadzenCategoryAxis>
|
|
|
|
<RadzenGridLines Visible="true" />
|
|
|
|
</RadzenCategoryAxis>
|
2023-01-28 18:55:59 +00:00
|
|
|
<RadzenLegend Visible="false" />
|
2023-01-27 23:31:32 +00:00
|
|
|
</RadzenChart>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
2023-01-22 22:15:55 +00:00
|
|
|
|
2023-01-26 21:54:09 +00:00
|
|
|
<div class="v-space"></div>
|
2023-01-22 22:15:55 +00:00
|
|
|
|
|
|
|
@code {
|
|
|
|
[Inject]
|
|
|
|
private NowHubCache nowCache { get; set; }
|
2023-01-23 18:11:37 +00:00
|
|
|
|
2023-01-27 23:31:32 +00:00
|
|
|
private bool smooth = true;
|
|
|
|
private bool showDataLabels = false;
|
|
|
|
private double strokeWidth = 5;
|
|
|
|
|
2023-01-28 18:55:59 +00:00
|
|
|
protected override void OnInitialized()
|
2023-01-23 18:11:37 +00:00
|
|
|
{
|
|
|
|
nowCache.NewNowPlaying += OnNewPlaying;
|
|
|
|
nowCache.NewCard += OnNewCard;
|
|
|
|
nowCache.NewPlayCount += OnNewPlayCount;
|
|
|
|
nowCache.NewAudioFeature += OnNewAudioFeature;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnNewPlaying(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnNewCard(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnNewPlayCount(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnNewAudioFeature(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Update()
|
|
|
|
{
|
|
|
|
Application.Current.Dispatcher.Dispatch(() =>
|
|
|
|
{
|
|
|
|
StateHasChanged();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
nowCache.NewNowPlaying -= OnNewPlaying;
|
|
|
|
nowCache.NewCard -= OnNewCard;
|
|
|
|
nowCache.NewPlayCount -= OnNewPlayCount;
|
|
|
|
nowCache.NewAudioFeature -= OnNewAudioFeature;
|
|
|
|
}
|
2023-01-22 22:15:55 +00:00
|
|
|
}
|
|
|
|
|