Skip to content

Commit

Permalink
应用推荐歌单卡片、电台卡片
Browse files Browse the repository at this point in the history
  • Loading branch information
Miaoyww committed Jul 22, 2024
1 parent 90525e1 commit c986e28
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
14 changes: 8 additions & 6 deletions NonsPlayer/ViewModels/ExploreViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ namespace NonsPlayer.ViewModels;

public partial class ExploreViewModel : ObservableRecipient, INavigationAware
{
[ObservableProperty] private IPlaylist dailyRecommendedPlaylist;
public ExploreViewModel()
{
}
[ObservableProperty] private IMusic[] dailyRecommendedPlaylist;

public void OnNavigatedTo(object parameter)
public async void OnNavigatedTo(object parameter)
{
var adapters = AdapterService.Instance.GetAdaptersByType(ISubAdapterEnum.Common);
foreach (var item in adapters)
{
item.Common.GetRecommendedPlaylistAsync(10);
var music = await item.Common.GetDailyRecommended();
if (music != null)
{
DailyRecommendedPlaylist = music;
break;
}
}
}

Expand Down
19 changes: 18 additions & 1 deletion NonsPlayer/Views/Pages/ExplorePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="using:NonsPlayer.Components.Views"
mc:Ignorable="d">

<Grid Margin="{StaticResource PageCommonMargin}">
<Grid Margin="{StaticResource PageContentCommonMargin}">

<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<views:RecommendedPlaylistCard Grid.Column="0"
Music="{x:Bind ViewModel.DailyRecommendedPlaylist, Mode=OneWay}" />
<views:RadioCard Grid.Column="1" />
</Grid>
<Grid Grid.Row="1">

</Grid>

</Grid>
</Grid>
</Page>

0 comments on commit c986e28

Please sign in to comment.