Rearranged WP8 demo project

This commit is contained in:
Rikki Tooley 2013-06-15 16:26:30 +01:00
parent 48cdea2aea
commit 7ab098d5a8
12 changed files with 40 additions and 43 deletions

View File

@ -92,7 +92,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="ApiTest.xaml.cs">
<Compile Include="Pages\ApiTest.xaml.cs">
<DependentUpon>ApiTest.xaml</DependentUpon>
</Compile>
<Compile Include="App.xaml.cs">
@ -109,23 +109,23 @@
<DesignTime>True</DesignTime>
<DependentUpon>AppResources.resx</DependentUpon>
</Compile>
<Compile Include="TestPages\ViewModels\BaseViewModel.cs" />
<Compile Include="TestPages\History.xaml.cs">
<Compile Include="ViewModels\BaseViewModel.cs" />
<Compile Include="Pages\UserApi\History.xaml.cs">
<DependentUpon>History.xaml</DependentUpon>
</Compile>
<Compile Include="TestPages\ViewModels\HistoryTestViewModel.cs" />
<Compile Include="TestPages\Scrobbling.xaml.cs">
<Compile Include="ViewModels\UserApi\HistoryTestViewModel.cs" />
<Compile Include="Pages\TrackApi\Scrobbling.xaml.cs">
<DependentUpon>Scrobbling.xaml</DependentUpon>
</Compile>
<Compile Include="TestPages\ViewModels\PageProgress.cs" />
<Compile Include="TestPages\ViewModels\ScrobblingTestViewModel.cs" />
<Compile Include="ViewModels\PageProgress.cs" />
<Compile Include="ViewModels\TrackApi\ScrobblingTestViewModel.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="ApiTest.xaml">
<Page Include="Pages\ApiTest.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@ -133,11 +133,11 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TestPages\History.xaml">
<Page Include="Pages\UserApi\History.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="TestPages\Scrobbling.xaml">
<Page Include="Pages\TrackApi\Scrobbling.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@ -40,7 +40,7 @@ private void OnDoneClick(object sender, EventArgs e)
service.Save();
NavigationService.Navigate(new Uri("/ApiTest.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri("/Pages/ApiTest.xaml", UriKind.Relative));
}
}
}

View File

@ -1,5 +1,5 @@
<phone:PhoneApplicationPage
x:Class="IF.Lastfm.Demo.Apollo.ApiTest"
x:Class="IF.Lastfm.Demo.Apollo.Pages.ApiTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"

View File

@ -2,7 +2,7 @@
using System.Windows;
using Microsoft.Phone.Controls;
namespace IF.Lastfm.Demo.Apollo
namespace IF.Lastfm.Demo.Apollo.Pages
{
public partial class ApiTest : PhoneApplicationPage
{
@ -13,7 +13,7 @@ public ApiTest()
private void OnScrobblingLinkClick(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/TestPages/Scrobbling.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri("/Pages/TrackApi/Scrobbling.xaml", UriKind.Relative));
}
private void OnAppBarSettingsClick(object sender, EventArgs e)
@ -23,7 +23,7 @@ private void OnAppBarSettingsClick(object sender, EventArgs e)
private void OnHistoryLinkClick(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/TestPages/History.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri("/Pages/UserApi/History.xaml", UriKind.Relative));
}
}
}

View File

@ -1,5 +1,5 @@
<phone:PhoneApplicationPage
x:Class="IF.Lastfm.Demo.Apollo.TestPages.Scrobbling"
x:Class="IF.Lastfm.Demo.Apollo.Pages.TrackApi.Scrobbling"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
@ -11,13 +11,14 @@
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:testPages="clr-namespace:IF.Lastfm.Demo.Apollo.TestPages"
xmlns:viewModels="clr-namespace:IF.Lastfm.Demo.Apollo.TestPages.ViewModels"
xmlns:trackApi="clr-namespace:IF.Lastfm.Demo.Apollo.ViewModels.TrackApi"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True"
d:DataContext="{d:DesignInstance viewModels:ScrobblingTestViewModel, IsDesignTimeCreatable=True}">
d:DataContext="{d:DesignInstance trackApi:ScrobblingTestViewModel, IsDesignTimeCreatable=True}">
<i:Interaction.Behaviors>
<behaviors:MultiApplicationBarBehavior x:Name="MultiApplicationBar">

View File

@ -1,16 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using IF.Lastfm.Demo.Apollo.TestPages.ViewModels;
using IF.Lastfm.Demo.Apollo.ViewModels.TrackApi;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace IF.Lastfm.Demo.Apollo.TestPages
namespace IF.Lastfm.Demo.Apollo.Pages.TrackApi
{
public partial class Scrobbling : PhoneApplicationPage
{

View File

@ -1,5 +1,5 @@
<phone:PhoneApplicationPage
x:Class="IF.Lastfm.Demo.Apollo.TestPages.History"
x:Class="IF.Lastfm.Demo.Apollo.Pages.UserApi.History"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
@ -11,13 +11,14 @@
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:testPages="clr-namespace:IF.Lastfm.Demo.Apollo.TestPages"
xmlns:viewModels="clr-namespace:IF.Lastfm.Demo.Apollo.TestPages.ViewModels"
xmlns:userApi="clr-namespace:IF.Lastfm.Demo.Apollo.ViewModels.UserApi"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True"
d:DataContext="{d:DesignInstance viewModels:HistoryTestViewModel, IsDesignTimeCreatable=True}">
d:DataContext="{d:DesignInstance userApi:HistoryTestViewModel, IsDesignTimeCreatable=True}">
<phone:PhoneApplicationPage.Resources>
<Style x:Key="EndlessScrollerTemplate" TargetType="ScrollViewer">

View File

@ -1,22 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Navigation;
using IF.Lastfm.Demo.Apollo.Annotations;
using IF.Lastfm.Demo.Apollo.TestPages.ViewModels;
using IF.Lastfm.Demo.Apollo.ViewModels.UserApi;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace IF.Lastfm.Demo.Apollo.TestPages
namespace IF.Lastfm.Demo.Apollo.Pages.UserApi
{
public partial class History : PhoneApplicationPage
{
@ -31,12 +24,12 @@ public History()
InitializeComponent();
_viewModel.PropertyChanged += OnViewModelPropertyChanged;
Loaded += OnLoaded;
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
private async void OnLoaded(object sender, RoutedEventArgs e)
{
base.OnNavigatedTo(e);
await _viewModel.NavigatedTo();
await _viewModel.GetHistory();
@ -64,6 +57,11 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
}
private void OnViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "InProgress")

View File

@ -2,8 +2,9 @@
using System.Threading.Tasks;
using Cimbalino.Phone.Toolkit.Services;
using IF.Lastfm.Core.Api;
using IF.Lastfm.Demo.Apollo.TestPages.ViewModels;
namespace IF.Lastfm.Demo.Apollo.TestPages.ViewModels
namespace IF.Lastfm.Demo.Apollo.ViewModels.TrackApi
{
public class ScrobblingTestViewModel : BaseViewModel
{
@ -122,7 +123,7 @@ public async Task Scrobble()
var auth = new Auth(apikey, apisecret);
await auth.GetSessionTokenAsync(username, pass);
var trackApi = new TrackApi(auth);
var trackApi = new Core.Api.TrackApi(auth);
var scrobble = new Scrobble(Artist, Album, Track, DateTime.UtcNow, AlbumArtist);

View File

@ -4,8 +4,9 @@
using Cimbalino.Phone.Toolkit.Services;
using IF.Lastfm.Core.Api;
using IF.Lastfm.Core.Objects;
using IF.Lastfm.Demo.Apollo.TestPages.ViewModels;
namespace IF.Lastfm.Demo.Apollo.TestPages.ViewModels
namespace IF.Lastfm.Demo.Apollo.ViewModels.UserApi
{
public class HistoryTestViewModel : BaseViewModel
{
@ -117,9 +118,9 @@ public async Task GetHistory()
InProgress = true;
var userApi = new UserApi(Auth);
var userApi = new Core.Api.UserApi(Auth);
var response = await userApi.GetRecentScrobbles(Auth.User.Username, DateTime.UtcNow.AddMonths(-1), _historyPageProgress.ExpectedPage, 60);
var response = await userApi.GetRecentScrobbles(Auth.User.Username, DateTime.UtcNow.AddMonths(-1), _historyPageProgress.ExpectedPage, 50);
Successful = response.Success;