mirror of
https://github.com/Sarsoo/IF.Lastfm.git
synced 2024-10-17 07:13:09 +01:00
Added artist top tracks and artist top albums methods to GetArtistInfo in demo app
This commit is contained in:
parent
941c38f01c
commit
c25d132185
@ -264,4 +264,5 @@
|
|||||||
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||||
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||||
</Target>
|
</Target>
|
||||||
|
<Import Project="$(XamlSpyInstallPath)MSBuild\FirstFloor.XamlSpy.WindowsPhone.targets" Condition="'$(XamlSpyInstallPath)' != '' and '$(Configuration)' == 'DEBUG'" />
|
||||||
</Project>
|
</Project>
|
@ -29,20 +29,38 @@
|
|||||||
</i:Interaction.Behaviors>
|
</i:Interaction.Behaviors>
|
||||||
|
|
||||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||||
<Grid.RowDefinitions>
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
||||||
<RowDefinition Height="Auto"/>
|
VerticalAlignment="Stretch">
|
||||||
<RowDefinition Height="*"/>
|
<StackPanel x:Name="ContentPanel"
|
||||||
</Grid.RowDefinitions>
|
Margin="12,17,12,0">
|
||||||
|
|
||||||
<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,17,12,0">
|
|
||||||
<TextBlock Text="LASTFM-WP DEMO APP" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
|
<TextBlock Text="LASTFM-WP DEMO APP" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
|
||||||
<TextBlock Text="artist info" Margin="9,-7,0,12" Style="{StaticResource PhoneTextTitle1Style}"/>
|
<TextBlock Text="artist info" Margin="9,-7,0,12" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||||
|
|
||||||
<toolkit:PhoneTextBox Hint="Artist" Text="{Binding ArtistName, Mode=TwoWay}"/>
|
<toolkit:PhoneTextBox Hint="Artist" Text="{Binding ArtistName, Mode=TwoWay}"/>
|
||||||
<toolkit:PhoneTextBox Hint="Track" Text="{Binding Track, Mode=TwoWay}"/>
|
|
||||||
<toolkit:PhoneTextBox Hint="Album" Text="{Binding Album, Mode=TwoWay}"/>
|
<TextBlock Text="top tracks" Margin="12,12,0,12" Style="{StaticResource PhoneTextTitle2Style}"/>
|
||||||
<toolkit:PhoneTextBox Hint="Album artist" Text="{Binding AlbumArtist, Mode=TwoWay}"/>
|
<ItemsControl ItemsSource="{Binding TopTracks}"
|
||||||
|
VerticalAlignment="Top">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"
|
||||||
|
Style="{StaticResource PhoneTextNormalStyle}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
|
||||||
|
<TextBlock Text="top albums" Margin="12,12,24,12" Style="{StaticResource PhoneTextTitle2Style}"/>
|
||||||
|
<ItemsControl ItemsSource="{Binding TopAlbums}"
|
||||||
|
VerticalAlignment="Top">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"
|
||||||
|
Style="{StaticResource PhoneTextNormalStyle}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</phone:PhoneApplicationPage>
|
</phone:PhoneApplicationPage>
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using IF.Lastfm.Demo.Apollo.TestPages.ViewModels;
|
|
||||||
using IF.Lastfm.Demo.Apollo.ViewModels.ArtistApi;
|
using IF.Lastfm.Demo.Apollo.ViewModels.ArtistApi;
|
||||||
using IF.Lastfm.Demo.Apollo.ViewModels.TrackApi;
|
|
||||||
using Microsoft.Phone.Controls;
|
using Microsoft.Phone.Controls;
|
||||||
using Microsoft.Phone.Shell;
|
using Microsoft.Phone.Shell;
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Cimbalino.Phone.Toolkit.Services;
|
using Cimbalino.Phone.Toolkit.Services;
|
||||||
using IF.Lastfm.Core.Api;
|
using IF.Lastfm.Core.Api;
|
||||||
@ -16,6 +12,8 @@ public class GetArtistInfoViewModel : BaseViewModel
|
|||||||
private string _artistName;
|
private string _artistName;
|
||||||
private Artist _artist;
|
private Artist _artist;
|
||||||
private bool _inProgress;
|
private bool _inProgress;
|
||||||
|
private IEnumerable<Track> _topTracks;
|
||||||
|
private IEnumerable<Album> _topAlbums;
|
||||||
|
|
||||||
public string ArtistName
|
public string ArtistName
|
||||||
{
|
{
|
||||||
@ -61,11 +59,43 @@ public bool InProgress
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Track> TopTracks
|
||||||
|
{
|
||||||
|
get { return _topTracks; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _topTracks))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_topTracks = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Album> TopAlbums
|
||||||
|
{
|
||||||
|
get { return _topAlbums; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _topAlbums))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_topAlbums = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetArtistInfoViewModel()
|
||||||
|
{
|
||||||
|
ArtistName = "Ben Frost";
|
||||||
|
}
|
||||||
|
|
||||||
public async Task GetInfo()
|
public async Task GetInfo()
|
||||||
{
|
{
|
||||||
InProgress = true;
|
InProgress = true;
|
||||||
|
|
||||||
|
|
||||||
var appsettings = new ApplicationSettingsService();
|
var appsettings = new ApplicationSettingsService();
|
||||||
var apikey = appsettings.Get<string>("apikey");
|
var apikey = appsettings.Get<string>("apikey");
|
||||||
var apisecret = appsettings.Get<string>("apisecret");
|
var apisecret = appsettings.Get<string>("apisecret");
|
||||||
@ -85,6 +115,18 @@ public async Task GetInfo()
|
|||||||
{
|
{
|
||||||
Artist = artist.Content;
|
Artist = artist.Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var topAlbums = await artistApi.GetTopAlbumsForArtistAsync(ArtistName);
|
||||||
|
if (topAlbums.Success)
|
||||||
|
{
|
||||||
|
TopAlbums = topAlbums;
|
||||||
|
}
|
||||||
|
|
||||||
|
var topTracks = await artistApi.GetTopTracksForArtistAsync(ArtistName);
|
||||||
|
if (topTracks.Success)
|
||||||
|
{
|
||||||
|
TopTracks = topTracks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InProgress = false;
|
InProgress = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user