WP8 demo app, scrobbling works!
@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using IF.Lastfm.Core.Api.Enums;
|
||||
using IF.Lastfm.Core.Api.Helpers;
|
||||
@ -12,15 +14,15 @@ namespace IF.Lastfm.Core.Api
|
||||
{
|
||||
public class Auth : IAuth
|
||||
{
|
||||
private const string ApiSignatureSeedFormat = "api_key{0}method{1}password{2}username{3}{4}";
|
||||
private const string ApiAuthMethod = "auth.getMobileSession";
|
||||
|
||||
private readonly string _apiSecret;
|
||||
private string _password;
|
||||
private string _username;
|
||||
|
||||
public bool HasAuthenticated { get { return User != null; } }
|
||||
public string ApiKey { get; private set; }
|
||||
public UserSession User { get; private set; }
|
||||
public string ApiSignature { get; private set; }
|
||||
|
||||
public Auth(string apikey, string secret)
|
||||
{
|
||||
@ -32,10 +34,12 @@ public async Task<LastResponse> GetSessionTokenAsync(string username, string pas
|
||||
{
|
||||
const string apiMethod = "auth.getMobileSession";
|
||||
|
||||
var apisigseed = string.Format(ApiSignatureSeedFormat, ApiKey, ApiAuthMethod, password, username, _apiSecret);
|
||||
ApiSignature = MD5.GetHashString(apisigseed);
|
||||
_password = password;
|
||||
_username = username;
|
||||
|
||||
var postContent = LastFm.CreatePostBody(apiMethod, ApiKey, ApiSignature, new Dictionary<string, string>
|
||||
var apisig = GenerateMethodSignature(apiMethod);
|
||||
|
||||
var postContent = LastFm.CreatePostBody(apiMethod, ApiKey, apisig, new Dictionary<string, string>
|
||||
{
|
||||
{"password", password},
|
||||
{"username", username}
|
||||
@ -59,5 +63,30 @@ public async Task<LastResponse> GetSessionTokenAsync(string username, string pas
|
||||
return LastResponse.CreateErrorResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
public string GenerateMethodSignature(string method, Dictionary<string, string> parameters = null)
|
||||
{
|
||||
if (parameters == null)
|
||||
{
|
||||
parameters = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
parameters.Add("api_key", ApiKey);
|
||||
parameters.Add("method", method);
|
||||
parameters.Add("password", _password);
|
||||
parameters.Add("username", _username);
|
||||
|
||||
var builder = new StringBuilder();
|
||||
|
||||
foreach (var kv in parameters.OrderBy(kv => kv.Key))
|
||||
{
|
||||
builder.Append(kv.Key);
|
||||
builder.Append(kv.Value);
|
||||
}
|
||||
|
||||
builder.Append(_apiSecret);
|
||||
|
||||
return MD5.GetHashString(builder.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@ -28,9 +28,11 @@ public static int ToInt(this bool b)
|
||||
return b ? 1 : 0;
|
||||
}
|
||||
|
||||
public static double ToUnixTimestamp(this DateTime dt)
|
||||
public static int ToUnixTimestamp(this DateTime dt)
|
||||
{
|
||||
return (dt - new DateTime(1970, 1, 1).ToUniversalTime()).TotalSeconds;
|
||||
var d = (dt - new DateTime(1970, 1, 1).ToUniversalTime()).TotalSeconds;
|
||||
|
||||
return Convert.ToInt32(d);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using IF.Lastfm.Core.Api.Helpers;
|
||||
using IF.Lastfm.Core.Objects;
|
||||
|
||||
@ -9,7 +10,6 @@ public interface IAuth
|
||||
bool HasAuthenticated { get; }
|
||||
string ApiKey { get; }
|
||||
UserSession User { get; }
|
||||
string ApiSignature { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the session token which is used as authentication for any service calls.
|
||||
@ -20,5 +20,7 @@ public interface IAuth
|
||||
/// <returns>Session token used to authenticate calls to last.fm</returns>
|
||||
/// <remarks>API: Auth.getMobileSession</remarks>
|
||||
Task<LastResponse> GetSessionTokenAsync(string username, string password);
|
||||
|
||||
string GenerateMethodSignature(string method, Dictionary<string, string> parameters = null);
|
||||
}
|
||||
}
|
@ -22,18 +22,23 @@ public async Task<LastResponse> ScrobbleAsync(Scrobble scrobble)
|
||||
{
|
||||
const string apiMethod = "track.scrobble";
|
||||
|
||||
var methodParameters = new Dictionary<string, string>
|
||||
{
|
||||
{"artist", scrobble.Artist},
|
||||
{"album", scrobble.Album},
|
||||
{"track", scrobble.Track},
|
||||
{"albumArtist", scrobble.AlbumArtist},
|
||||
{"chosenByUser", scrobble.ChosenByUser.ToInt().ToString()},
|
||||
{"timestamp", scrobble.TimePlayed.ToUnixTimestamp().ToString()},
|
||||
{"sk", Auth.User.Token}
|
||||
};
|
||||
|
||||
var apisig = Auth.GenerateMethodSignature(apiMethod, methodParameters);
|
||||
|
||||
var postContent = LastFm.CreatePostBody(apiMethod,
|
||||
Auth.ApiKey,
|
||||
Auth.ApiSignature,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{"artist", scrobble.Artist},
|
||||
{"album", scrobble.Album},
|
||||
{"track", scrobble.Track},
|
||||
{"albumArtist", scrobble.AlbumArtist},
|
||||
{"chosenByUser", scrobble.ChosenByUser.ToInt().ToString()},
|
||||
{"timestamp", scrobble.TimePlayed.ToUnixTimestamp().ToString()}
|
||||
});
|
||||
apisig,
|
||||
methodParameters);
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
HttpResponseMessage response = await httpClient.PostAsync(LastFm.ApiRoot, postContent);
|
||||
|
43
IF.Lastfm.Demo.Apollo/ApiTest.xaml
Normal file
@ -0,0 +1,43 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="IF.Lastfm.Demo.Apollo.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"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:behaviors="clr-namespace:Cimbalino.Phone.Toolkit.Behaviors;assembly=Cimbalino.Phone.Toolkit"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<behaviors:MultiApplicationBarBehavior x:Name="MultiApplicationBar">
|
||||
<behaviors:ApplicationBar>
|
||||
<behaviors:ApplicationBarIconButton Click="OnAppBarSettingsClick"
|
||||
IconUri="/Toolkit.Content/ApplicationBar.Check.png"
|
||||
Text="settings" />
|
||||
</behaviors:ApplicationBar>
|
||||
</behaviors:MultiApplicationBarBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<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="api" Margin="9,-7,0,12" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
|
||||
<Button Content="Scrobbling" Click="OnScrobblingLinkClick"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
30
IF.Lastfm.Demo.Apollo/ApiTest.xaml.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo
|
||||
{
|
||||
public partial class ApiTest : PhoneApplicationPage
|
||||
{
|
||||
public ApiTest()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnScrobblingLinkClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NavigationService.Navigate(new Uri("/TestPages/Scrobbling.xaml", UriKind.Relative));
|
||||
}
|
||||
|
||||
private void OnAppBarSettingsClick(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
20
IF.Lastfm.Demo.Apollo/App.xaml
Normal file
@ -0,0 +1,20 @@
|
||||
<Application
|
||||
x:Class="IF.Lastfm.Demo.Apollo.App"
|
||||
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"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
|
||||
|
||||
<!--Application Resources-->
|
||||
<Application.Resources>
|
||||
<local:LocalizedStrings xmlns:local="clr-namespace:IF.Lastfm.Demo.Apollo" x:Key="LocalizedStrings"/>
|
||||
</Application.Resources>
|
||||
|
||||
<Application.ApplicationLifetimeObjects>
|
||||
<!--Required object that handles lifetime events for the application-->
|
||||
<shell:PhoneApplicationService
|
||||
Launching="Application_Launching" Closing="Application_Closing"
|
||||
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
|
||||
</Application.ApplicationLifetimeObjects>
|
||||
|
||||
</Application>
|
223
IF.Lastfm.Demo.Apollo/App.xaml.cs
Normal file
@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Resources;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using IF.Lastfm.Demo.Apollo.Resources;
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides easy access to the root frame of the Phone Application.
|
||||
/// </summary>
|
||||
/// <returns>The root frame of the Phone Application.</returns>
|
||||
public static PhoneApplicationFrame RootFrame { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for the Application object.
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
// Global handler for uncaught exceptions.
|
||||
UnhandledException += Application_UnhandledException;
|
||||
|
||||
// Standard XAML initialization
|
||||
InitializeComponent();
|
||||
|
||||
// Phone-specific initialization
|
||||
InitializePhoneApplication();
|
||||
|
||||
// Language display initialization
|
||||
InitializeLanguage();
|
||||
|
||||
// Show graphics profiling information while debugging.
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
// Display the current frame rate counters.
|
||||
Application.Current.Host.Settings.EnableFrameRateCounter = true;
|
||||
|
||||
// Show the areas of the app that are being redrawn in each frame.
|
||||
//Application.Current.Host.Settings.EnableRedrawRegions = true;
|
||||
|
||||
// Enable non-production analysis visualization mode,
|
||||
// which shows areas of a page that are handed off to GPU with a colored overlay.
|
||||
//Application.Current.Host.Settings.EnableCacheVisualization = true;
|
||||
|
||||
// Prevent the screen from turning off while under the debugger by disabling
|
||||
// the application's idle detection.
|
||||
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
|
||||
// and consume battery power when the user is not using the phone.
|
||||
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Code to execute when the application is launching (eg, from Start)
|
||||
// This code will not execute when the application is reactivated
|
||||
private void Application_Launching(object sender, LaunchingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is activated (brought to foreground)
|
||||
// This code will not execute when the application is first launched
|
||||
private void Application_Activated(object sender, ActivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is deactivated (sent to background)
|
||||
// This code will not execute when the application is closing
|
||||
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is closing (eg, user hit Back)
|
||||
// This code will not execute when the application is deactivated
|
||||
private void Application_Closing(object sender, ClosingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute if a navigation fails
|
||||
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
// A navigation has failed; break into the debugger
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
// Code to execute on Unhandled Exceptions
|
||||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
// An unhandled exception has occurred; break into the debugger
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
#region Phone application initialization
|
||||
|
||||
// Avoid double-initialization
|
||||
private bool phoneApplicationInitialized = false;
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void InitializePhoneApplication()
|
||||
{
|
||||
if (phoneApplicationInitialized)
|
||||
return;
|
||||
|
||||
// Create the frame but don't set it as RootVisual yet; this allows the splash
|
||||
// screen to remain active until the application is ready to render.
|
||||
RootFrame = new PhoneApplicationFrame();
|
||||
RootFrame.Navigated += CompleteInitializePhoneApplication;
|
||||
|
||||
// Handle navigation failures
|
||||
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
|
||||
|
||||
// Handle reset requests for clearing the backstack
|
||||
RootFrame.Navigated += CheckForResetNavigation;
|
||||
|
||||
// Ensure we don't initialize again
|
||||
phoneApplicationInitialized = true;
|
||||
}
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
|
||||
{
|
||||
// Set the root visual to allow the application to render
|
||||
if (RootVisual != RootFrame)
|
||||
RootVisual = RootFrame;
|
||||
|
||||
// Remove this handler since it is no longer needed
|
||||
RootFrame.Navigated -= CompleteInitializePhoneApplication;
|
||||
}
|
||||
|
||||
private void CheckForResetNavigation(object sender, NavigationEventArgs e)
|
||||
{
|
||||
// If the app has received a 'reset' navigation, then we need to check
|
||||
// on the next navigation to see if the page stack should be reset
|
||||
if (e.NavigationMode == NavigationMode.Reset)
|
||||
RootFrame.Navigated += ClearBackStackAfterReset;
|
||||
}
|
||||
|
||||
private void ClearBackStackAfterReset(object sender, NavigationEventArgs e)
|
||||
{
|
||||
// Unregister the event so it doesn't get called again
|
||||
RootFrame.Navigated -= ClearBackStackAfterReset;
|
||||
|
||||
// Only clear the stack for 'new' (forward) and 'refresh' navigations
|
||||
if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh)
|
||||
return;
|
||||
|
||||
// For UI consistency, clear the entire page stack
|
||||
while (RootFrame.RemoveBackEntry() != null)
|
||||
{
|
||||
; // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// Initialize the app's font and flow direction as defined in its localized resource strings.
|
||||
//
|
||||
// To ensure that the font of your application is aligned with its supported languages and that the
|
||||
// FlowDirection for each of those languages follows its traditional direction, ResourceLanguage
|
||||
// and ResourceFlowDirection should be initialized in each resx file to match these values with that
|
||||
// file's culture. For example:
|
||||
//
|
||||
// AppResources.es-ES.resx
|
||||
// ResourceLanguage's value should be "es-ES"
|
||||
// ResourceFlowDirection's value should be "LeftToRight"
|
||||
//
|
||||
// AppResources.ar-SA.resx
|
||||
// ResourceLanguage's value should be "ar-SA"
|
||||
// ResourceFlowDirection's value should be "RightToLeft"
|
||||
//
|
||||
// For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072.
|
||||
//
|
||||
private void InitializeLanguage()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Set the font to match the display language defined by the
|
||||
// ResourceLanguage resource string for each supported language.
|
||||
//
|
||||
// Fall back to the font of the neutral language if the Display
|
||||
// language of the phone is not supported.
|
||||
//
|
||||
// If a compiler error is hit then ResourceLanguage is missing from
|
||||
// the resource file.
|
||||
RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);
|
||||
|
||||
// Set the FlowDirection of all elements under the root frame based
|
||||
// on the ResourceFlowDirection resource string for each
|
||||
// supported language.
|
||||
//
|
||||
// If a compiler error is hit then ResourceFlowDirection is missing from
|
||||
// the resource file.
|
||||
FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
|
||||
RootFrame.FlowDirection = flow;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If an exception is caught here it is most likely due to either
|
||||
// ResourceLangauge not being correctly set to a supported language
|
||||
// code or ResourceFlowDirection is set to a value other than LeftToRight
|
||||
// or RightToLeft.
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
IF.Lastfm.Demo.Apollo/Assets/AlignmentGrid.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
IF.Lastfm.Demo.Apollo/Assets/ApplicationIcon.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
IF.Lastfm.Demo.Apollo/Assets/Tiles/FlipCycleTileLarge.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
IF.Lastfm.Demo.Apollo/Assets/Tiles/FlipCycleTileMedium.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
IF.Lastfm.Demo.Apollo/Assets/Tiles/FlipCycleTileSmall.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
IF.Lastfm.Demo.Apollo/Assets/Tiles/IconicTileMediumLarge.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
IF.Lastfm.Demo.Apollo/Assets/Tiles/IconicTileSmall.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
215
IF.Lastfm.Demo.Apollo/IF.Lastfm.Demo.Apollo.csproj
Normal file
@ -0,0 +1,215 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.20506</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IF.Lastfm.Demo.Apollo</RootNamespace>
|
||||
<AssemblyName>IF.Lastfm.Demo.Apollo</AssemblyName>
|
||||
<TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
|
||||
<SilverlightApplication>true</SilverlightApplication>
|
||||
<SupportedCultures>
|
||||
</SupportedCultures>
|
||||
<XapOutputs>true</XapOutputs>
|
||||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
|
||||
<XapFilename>IF.Lastfm.Demo.Apollo_$(Configuration)_$(Platform).xap</XapFilename>
|
||||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
|
||||
<SilverlightAppEntry>IF.Lastfm.Demo.Apollo.App</SilverlightAppEntry>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\x86\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\x86\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\ARM\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\ARM\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ApiTest.xaml.cs">
|
||||
<DependentUpon>ApiTest.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocalizedStrings.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\AppResources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>AppResources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TestPages\Scrobbling.xaml.cs">
|
||||
<DependentUpon>Scrobbling.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="ApiTest.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="TestPages\Scrobbling.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
<None Include="Properties\WMAppManifest.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\AlignmentGrid.png" />
|
||||
<Content Include="Assets\ApplicationIcon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\FlipCycleTileLarge.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\FlipCycleTileMedium.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\FlipCycleTileSmall.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\IconicTileMediumLarge.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\IconicTileSmall.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="README_FIRST.txt" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Check.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Delete.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Select.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\AppResources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>AppResources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cimbalino.Phone.Toolkit">
|
||||
<HintPath>..\packages\Cimbalino.Phone.Toolkit.3.0.0\lib\wp8\Cimbalino.Phone.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cimbalino.Phone.Toolkit.Background">
|
||||
<HintPath>..\packages\Cimbalino.Phone.Toolkit.Background.3.0.0\lib\wp8\Cimbalino.Phone.Toolkit.Background.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cimbalino.Phone.Toolkit.Controls">
|
||||
<HintPath>..\packages\Cimbalino.Phone.Toolkit.Controls.3.0.0\lib\wp8\Cimbalino.Phone.Toolkit.Controls.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Phone.Controls.Toolkit">
|
||||
<HintPath>..\packages\WPToolkit.4.2013.06.11\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\wp8\Microsoft.Threading.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks.Extensions">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\wp8\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks.Extensions.Phone">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\wp8\Microsoft.Threading.Tasks.Extensions.Phone.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Interactivity, Version=3.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IF.Lastfm.Core\IF.Lastfm.Core.csproj">
|
||||
<Project>{C4B8883C-757A-4952-81D0-34221BAABB67}</Project>
|
||||
<Name>IF.Lastfm.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" />
|
||||
</Project>
|
14
IF.Lastfm.Demo.Apollo/LocalizedStrings.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using IF.Lastfm.Demo.Apollo.Resources;
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to string resources.
|
||||
/// </summary>
|
||||
public class LocalizedStrings
|
||||
{
|
||||
private static AppResources _localizedResources = new AppResources();
|
||||
|
||||
public AppResources LocalizedResources { get { return _localizedResources; } }
|
||||
}
|
||||
}
|
48
IF.Lastfm.Demo.Apollo/MainPage.xaml
Normal file
@ -0,0 +1,48 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="IF.Lastfm.Demo.Apollo.MainPage"
|
||||
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"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
xmlns:behaviors="clr-namespace:Cimbalino.Phone.Toolkit.Behaviors;assembly=Cimbalino.Phone.Toolkit"
|
||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<behaviors:MultiApplicationBarBehavior x:Name="MultiApplicationBar">
|
||||
<behaviors:ApplicationBar>
|
||||
<behaviors:ApplicationBarIconButton Click="OnDoneClick"
|
||||
IconUri="/Toolkit.Content/ApplicationBar.Check.png"
|
||||
Text="done" />
|
||||
</behaviors:ApplicationBar>
|
||||
</behaviors:MultiApplicationBarBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="LASTFM-WP DEMO APP" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
|
||||
<TextBlock Text="setup" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<toolkit:PhoneTextBox x:Name="ApiKey" Hint="Api key"/>
|
||||
<toolkit:PhoneTextBox x:Name="ApiSecret" Hint="Api secret"/>
|
||||
<toolkit:PhoneTextBox x:Name="Username" Hint="Username"/>
|
||||
<toolkit:PhoneTextBox x:Name="Password" Hint="Password"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
46
IF.Lastfm.Demo.Apollo/MainPage.xaml.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Cimbalino.Phone.Toolkit.Services;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo
|
||||
{
|
||||
public partial class MainPage : PhoneApplicationPage
|
||||
{
|
||||
// Constructor
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
MultiApplicationBar.SelectedIndex = 0;
|
||||
|
||||
var service = new ApplicationSettingsService();
|
||||
|
||||
if (service.Get<string>("apikey") == string.Empty)
|
||||
{
|
||||
ApiKey.Text = "a6ab4b9376e54cdb06912bfbd9c1f288";
|
||||
ApiSecret.Text = "3aa7202fd1bc6d5a7ac733246cbccc4b";
|
||||
}
|
||||
else
|
||||
{
|
||||
ApiKey.Text = service.Get<string>("apikey");
|
||||
ApiSecret.Text = service.Get<string>("apisecret");
|
||||
Username.Text = service.Get<string>("username");
|
||||
Password.Text = service.Get<string>("pass");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDoneClick(object sender, EventArgs e)
|
||||
{
|
||||
var service = new ApplicationSettingsService();
|
||||
|
||||
service.Set("apikey", ApiKey.Text);
|
||||
service.Set("apisecret", ApiSecret.Text);
|
||||
service.Set("username", Username.Text);
|
||||
service.Set("pass", Password.Text);
|
||||
|
||||
service.Save();
|
||||
|
||||
NavigationService.Navigate(new Uri("/ApiTest.xaml", UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
593
IF.Lastfm.Demo.Apollo/Properties/Annotations.cs
Normal file
@ -0,0 +1,593 @@
|
||||
/*
|
||||
* Copyright 2007-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
#pragma warning disable 1591
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable IntroduceOptionalParameters.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo.Annotations
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the value of the marked element could be <c>null</c> sometimes,
|
||||
/// so the check for <c>null</c> is necessary before its usage
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [CanBeNull] public object Test() { return null; }
|
||||
/// public void UseTest() {
|
||||
/// var p = Test();
|
||||
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter |
|
||||
AttributeTargets.Property | AttributeTargets.Delegate |
|
||||
AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class CanBeNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the value of the marked element could never be <c>null</c>
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [NotNull] public object Foo() {
|
||||
/// return null; // Warning: Possible 'null' assignment
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter |
|
||||
AttributeTargets.Property | AttributeTargets.Delegate |
|
||||
AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class NotNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the marked method builds string by format pattern and (optional) arguments.
|
||||
/// Parameter, which contains format string, should be given in constructor. The format string
|
||||
/// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [StringFormatMethod("message")]
|
||||
/// public void ShowError(string message, params object[] args) { /* do something */ }
|
||||
/// public void Foo() {
|
||||
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Constructor | AttributeTargets.Method,
|
||||
AllowMultiple = false, Inherited = true)]
|
||||
public sealed class StringFormatMethodAttribute : Attribute
|
||||
{
|
||||
/// <param name="formatParameterName">
|
||||
/// Specifies which parameter of an annotated method should be treated as format-string
|
||||
/// </param>
|
||||
public StringFormatMethodAttribute(string formatParameterName)
|
||||
{
|
||||
FormatParameterName = formatParameterName;
|
||||
}
|
||||
|
||||
public string FormatParameterName { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the function argument should be string literal and match one
|
||||
/// of the parameters of the caller function. For example, ReSharper annotates
|
||||
/// the parameter of <see cref="System.ArgumentNullException"/>
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// public void Foo(string param) {
|
||||
/// if (param == null)
|
||||
/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class InvokerParameterNameAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the method is contained in a type that implements
|
||||
/// <see cref="System.ComponentModel.INotifyPropertyChanged"/> interface
|
||||
/// and this method is used to notify that some property value changed
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The method should be non-static and conform to one of the supported signatures:
|
||||
/// <list>
|
||||
/// <item><c>NotifyChanged(string)</c></item>
|
||||
/// <item><c>NotifyChanged(params string[])</c></item>
|
||||
/// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
|
||||
/// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
|
||||
/// <item><c>SetProperty{T}(ref T, T, string)</c></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <example><code>
|
||||
/// public class Foo : INotifyPropertyChanged {
|
||||
/// public event PropertyChangedEventHandler PropertyChanged;
|
||||
/// [NotifyPropertyChangedInvocator]
|
||||
/// protected virtual void NotifyChanged(string propertyName) { ... }
|
||||
///
|
||||
/// private string _name;
|
||||
/// public string Name {
|
||||
/// get { return _name; }
|
||||
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
|
||||
/// }
|
||||
/// }
|
||||
/// </code>
|
||||
/// Examples of generated notifications:
|
||||
/// <list>
|
||||
/// <item><c>NotifyChanged("Property")</c></item>
|
||||
/// <item><c>NotifyChanged(() => Property)</c></item>
|
||||
/// <item><c>NotifyChanged((VM x) => x.Property)</c></item>
|
||||
/// <item><c>SetProperty(ref myField, value, "Property")</c></item>
|
||||
/// </list>
|
||||
/// </example>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
|
||||
{
|
||||
public NotifyPropertyChangedInvocatorAttribute() { }
|
||||
public NotifyPropertyChangedInvocatorAttribute(string parameterName)
|
||||
{
|
||||
ParameterName = parameterName;
|
||||
}
|
||||
|
||||
public string ParameterName { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes dependency between method input and output
|
||||
/// </summary>
|
||||
/// <syntax>
|
||||
/// <p>Function Definition Table syntax:</p>
|
||||
/// <list>
|
||||
/// <item>FDT ::= FDTRow [;FDTRow]*</item>
|
||||
/// <item>FDTRow ::= Input => Output | Output <= Input</item>
|
||||
/// <item>Input ::= ParameterName: Value [, Input]*</item>
|
||||
/// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
|
||||
/// <item>Value ::= true | false | null | notnull | canbenull</item>
|
||||
/// </list>
|
||||
/// If method has single input parameter, it's name could be omitted.<br/>
|
||||
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
|
||||
/// for method output means that the methos doesn't return normally.<br/>
|
||||
/// <c>canbenull</c> annotation is only applicable for output parameters.<br/>
|
||||
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
|
||||
/// or use single attribute with rows separated by semicolon.<br/>
|
||||
/// </syntax>
|
||||
/// <examples><list>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("=> halt")]
|
||||
/// public void TerminationMethod()
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("halt <= condition: false")]
|
||||
/// public void Assert(bool condition, string text) // regular assertion method
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("s:null => true")]
|
||||
/// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// // A method that returns null if the parameter is null, and not null if the parameter is not null
|
||||
/// [ContractAnnotation("null => null; notnull => notnull")]
|
||||
/// public object Transform(object data)
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
|
||||
/// public bool TryParse(string s, out Person result)
|
||||
/// </code></item>
|
||||
/// </list></examples>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||
public sealed class ContractAnnotationAttribute : Attribute
|
||||
{
|
||||
public ContractAnnotationAttribute([NotNull] string contract)
|
||||
: this(contract, false) { }
|
||||
|
||||
public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
|
||||
{
|
||||
Contract = contract;
|
||||
ForceFullStates = forceFullStates;
|
||||
}
|
||||
|
||||
public string Contract { get; private set; }
|
||||
public bool ForceFullStates { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that marked element should be localized or not
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [LocalizationRequiredAttribute(true)]
|
||||
/// public class Foo {
|
||||
/// private string str = "my string"; // Warning: Localizable string
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class LocalizationRequiredAttribute : Attribute
|
||||
{
|
||||
public LocalizationRequiredAttribute() : this(true) { }
|
||||
public LocalizationRequiredAttribute(bool required)
|
||||
{
|
||||
Required = required;
|
||||
}
|
||||
|
||||
public bool Required { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the value of the marked type (or its derivatives)
|
||||
/// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
|
||||
/// should be used instead. However, using '==' or '!=' for comparison
|
||||
/// with <c>null</c> is always permitted.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [CannotApplyEqualityOperator]
|
||||
/// class NoEquality { }
|
||||
/// class UsesNoEquality {
|
||||
/// public void Test() {
|
||||
/// var ca1 = new NoEquality();
|
||||
/// var ca2 = new NoEquality();
|
||||
/// if (ca1 != null) { // OK
|
||||
/// bool condition = ca1 == ca2; // Warning
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Interface | AttributeTargets.Class |
|
||||
AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class CannotApplyEqualityOperatorAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// When applied to a target attribute, specifies a requirement for any type marked
|
||||
/// with the target attribute to implement or inherit specific type or types.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
|
||||
/// public class ComponentAttribute : Attribute { }
|
||||
/// [Component] // ComponentAttribute requires implementing IComponent interface
|
||||
/// public class MyComponent : IComponent { }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
[BaseTypeRequired(typeof(Attribute))]
|
||||
public sealed class BaseTypeRequiredAttribute : Attribute
|
||||
{
|
||||
public BaseTypeRequiredAttribute([NotNull] Type baseType)
|
||||
{
|
||||
BaseType = baseType;
|
||||
}
|
||||
|
||||
[NotNull] public Type BaseType { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the marked symbol is used implicitly
|
||||
/// (e.g. via reflection, in external library), so this symbol
|
||||
/// will not be marked as unused (as well as by other usage inspections)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class UsedImplicitlyAttribute : Attribute
|
||||
{
|
||||
public UsedImplicitlyAttribute()
|
||||
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
|
||||
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
|
||||
: this(ImplicitUseKindFlags.Default, targetFlags) { }
|
||||
|
||||
public UsedImplicitlyAttribute(
|
||||
ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
|
||||
{
|
||||
UseKindFlags = useKindFlags;
|
||||
TargetFlags = targetFlags;
|
||||
}
|
||||
|
||||
public ImplicitUseKindFlags UseKindFlags { get; private set; }
|
||||
public ImplicitUseTargetFlags TargetFlags { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should be used on attributes and causes ReSharper
|
||||
/// to not mark symbols marked with such attributes as unused
|
||||
/// (as well as by other usage inspections)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class MeansImplicitUseAttribute : Attribute
|
||||
{
|
||||
public MeansImplicitUseAttribute()
|
||||
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
|
||||
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
|
||||
: this(ImplicitUseKindFlags.Default, targetFlags) { }
|
||||
|
||||
public MeansImplicitUseAttribute(
|
||||
ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
|
||||
{
|
||||
UseKindFlags = useKindFlags;
|
||||
TargetFlags = targetFlags;
|
||||
}
|
||||
|
||||
[UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
|
||||
[UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ImplicitUseKindFlags
|
||||
{
|
||||
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
|
||||
/// <summary>Only entity marked with attribute considered used</summary>
|
||||
Access = 1,
|
||||
/// <summary>Indicates implicit assignment to a member</summary>
|
||||
Assign = 2,
|
||||
/// <summary>
|
||||
/// Indicates implicit instantiation of a type with fixed constructor signature.
|
||||
/// That means any unused constructor parameters won't be reported as such.
|
||||
/// </summary>
|
||||
InstantiatedWithFixedConstructorSignature = 4,
|
||||
/// <summary>Indicates implicit instantiation of a type</summary>
|
||||
InstantiatedNoFixedConstructorSignature = 8,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specify what is considered used implicitly
|
||||
/// when marked with <see cref="MeansImplicitUseAttribute"/>
|
||||
/// or <see cref="UsedImplicitlyAttribute"/>
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ImplicitUseTargetFlags
|
||||
{
|
||||
Default = Itself,
|
||||
Itself = 1,
|
||||
/// <summary>Members of entity marked with attribute are considered used</summary>
|
||||
Members = 2,
|
||||
/// <summary>Entity marked with attribute and all its members considered used</summary>
|
||||
WithMembers = Itself | Members
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This attribute is intended to mark publicly available API
|
||||
/// which should not be removed and so is treated as used
|
||||
/// </summary>
|
||||
[MeansImplicitUse]
|
||||
public sealed class PublicAPIAttribute : Attribute
|
||||
{
|
||||
public PublicAPIAttribute() { }
|
||||
public PublicAPIAttribute([NotNull] string comment)
|
||||
{
|
||||
Comment = comment;
|
||||
}
|
||||
|
||||
[NotNull] public string Comment { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tells code analysis engine if the parameter is completely handled
|
||||
/// when the invoked method is on stack. If the parameter is a delegate,
|
||||
/// indicates that delegate is executed while the method is executed.
|
||||
/// If the parameter is an enumerable, indicates that it is enumerated
|
||||
/// while the method is executed
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter, Inherited = true)]
|
||||
public sealed class InstantHandleAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a method does not make any observable state changes.
|
||||
/// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [Pure] private int Multiply(int x, int y) { return x * y; }
|
||||
/// public void Foo() {
|
||||
/// const int a = 2, b = 2;
|
||||
/// Multiply(a, b); // Waring: Return value of pure method is not used
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
|
||||
public sealed class PureAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a parameter is a path to a file or a folder
|
||||
/// within a web project. Path can be relative or absolute,
|
||||
/// starting from web root (~)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public class PathReferenceAttribute : Attribute
|
||||
{
|
||||
public PathReferenceAttribute() { }
|
||||
public PathReferenceAttribute([PathReference] string basePath)
|
||||
{
|
||||
BasePath = basePath;
|
||||
}
|
||||
|
||||
[NotNull] public string BasePath { get; private set; }
|
||||
}
|
||||
|
||||
// ASP.NET MVC attributes
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
|
||||
/// is an MVC action. If applied to a method, the MVC action name is calculated
|
||||
/// implicitly from the context. Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcActionAttribute : Attribute
|
||||
{
|
||||
public AspMvcActionAttribute() { }
|
||||
public AspMvcActionAttribute([NotNull] string anonymousProperty)
|
||||
{
|
||||
AnonymousProperty = anonymousProperty;
|
||||
}
|
||||
|
||||
[NotNull] public string AnonymousProperty { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcAreaAttribute : PathReferenceAttribute
|
||||
{
|
||||
public AspMvcAreaAttribute() { }
|
||||
public AspMvcAreaAttribute([NotNull] string anonymousProperty)
|
||||
{
|
||||
AnonymousProperty = anonymousProperty;
|
||||
}
|
||||
|
||||
[NotNull] public string AnonymousProperty { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that
|
||||
/// the parameter is an MVC controller. If applied to a method,
|
||||
/// the MVC controller name is calculated implicitly from the context.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcControllerAttribute : Attribute
|
||||
{
|
||||
public AspMvcControllerAttribute() { }
|
||||
public AspMvcControllerAttribute([NotNull] string anonymousProperty)
|
||||
{
|
||||
AnonymousProperty = anonymousProperty;
|
||||
}
|
||||
|
||||
[NotNull] public string AnonymousProperty { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Controller.View(String, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcMasterAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Controller.View(String, Object)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcModelTypeAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that
|
||||
/// the parameter is an MVC partial view. If applied to a method,
|
||||
/// the MVC partial view name is calculated implicitly from the context.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcPartialViewAttribute : PathReferenceAttribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Allows disabling all inspections
|
||||
/// for MVC views within a class or a method.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public sealed class AspMvcSupressViewErrorAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcDisplayTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcEditorTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
|
||||
/// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
|
||||
/// from the context. Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Controller.View(Object)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcViewAttribute : PathReferenceAttribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. When applied to a parameter of an attribute,
|
||||
/// indicates that this parameter is an MVC action name
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [ActionName("Foo")]
|
||||
/// public ActionResult Login(string returnUrl) {
|
||||
/// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
|
||||
/// return RedirectToAction("Bar"); // Error: Cannot resolve action
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
|
||||
public sealed class AspMvcActionSelectorAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Parameter | AttributeTargets.Property |
|
||||
AttributeTargets.Field, Inherited = true)]
|
||||
public sealed class HtmlElementAttributesAttribute : Attribute
|
||||
{
|
||||
public HtmlElementAttributesAttribute() { }
|
||||
public HtmlElementAttributesAttribute([NotNull] string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
[NotNull] public string Name { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Parameter | AttributeTargets.Field |
|
||||
AttributeTargets.Property, Inherited = true)]
|
||||
public sealed class HtmlAttributeValueAttribute : Attribute
|
||||
{
|
||||
public HtmlAttributeValueAttribute([NotNull] string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
[NotNull] public string Name { get; private set; }
|
||||
}
|
||||
|
||||
// Razor attributes
|
||||
|
||||
/// <summary>
|
||||
/// Razor attribute. Indicates that a parameter or a method is a Razor section.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, Inherited = true)]
|
||||
public sealed class RazorSectionAttribute : Attribute { }
|
||||
}
|
6
IF.Lastfm.Demo.Apollo/Properties/AppManifest.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Deployment.Parts>
|
||||
</Deployment.Parts>
|
||||
</Deployment>
|
37
IF.Lastfm.Demo.Apollo/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Resources;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("IF.Lastfm.Demo.Apollo")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("IF.Lastfm.Demo.Apollo")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9d5bf763-0416-4a04-ac45-d25a48757779")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en-US")]
|
38
IF.Lastfm.Demo.Apollo/Properties/WMAppManifest.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
|
||||
<DefaultLanguage xmlns="" code="en-US"/>
|
||||
<App xmlns="" ProductID="{3b3cf5ed-2107-4bfa-9e0e-bcb8260c174b}" Title="IF.Lastfm.Demo.Apollo" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="IF.Lastfm.Demo.Apollo author" Description="Sample description" Publisher="IF.Lastfm.Demo.Apollo" PublisherID="{4eae392f-c5cb-4add-b1d0-84a3e639cef0}">
|
||||
<IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath>
|
||||
<Capabilities>
|
||||
<Capability Name="ID_CAP_NETWORKING"/>
|
||||
<Capability Name="ID_CAP_MEDIALIB_AUDIO"/>
|
||||
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK"/>
|
||||
<Capability Name="ID_CAP_SENSORS"/>
|
||||
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="IF.Lastfm.Demo.ApolloToken" TaskName="_default">
|
||||
<TemplateFlip>
|
||||
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI>
|
||||
<Count>0</Count>
|
||||
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
|
||||
<Title>IF.Lastfm.Demo.Apollo</Title>
|
||||
<BackContent></BackContent>
|
||||
<BackBackgroundImageURI></BackBackgroundImageURI>
|
||||
<BackTitle></BackTitle>
|
||||
<DeviceLockImageURI></DeviceLockImageURI>
|
||||
<HasLarge></HasLarge>
|
||||
</TemplateFlip>
|
||||
</PrimaryToken>
|
||||
</Tokens>
|
||||
<ScreenResolutions>
|
||||
<ScreenResolution Name="ID_RESOLUTION_WVGA"/>
|
||||
<ScreenResolution Name="ID_RESOLUTION_WXGA"/>
|
||||
<ScreenResolution Name="ID_RESOLUTION_HD720P"/>
|
||||
</ScreenResolutions>
|
||||
</App>
|
||||
</Deployment>
|
3
IF.Lastfm.Demo.Apollo/README_FIRST.txt
Normal file
@ -0,0 +1,3 @@
|
||||
For the Windows Phone toolkit make sure that you have
|
||||
marked the icons in the "Toolkit.Content" folder as content. That way they
|
||||
can be used as the icons for the ApplicationBar control.
|
127
IF.Lastfm.Demo.Apollo/Resources/AppResources.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17626
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo.Resources
|
||||
{
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class AppResources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal AppResources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (object.ReferenceEquals(resourceMan, null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IF.Lastfm.Demo.Apollo.Resources.AppResources", typeof(AppResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to LeftToRight.
|
||||
/// </summary>
|
||||
public static string ResourceFlowDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("ResourceFlowDirection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to us-EN.
|
||||
/// </summary>
|
||||
public static string ResourceLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("ResourceLanguage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to MY APPLICATION.
|
||||
/// </summary>
|
||||
public static string ApplicationTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("ApplicationTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to button.
|
||||
/// </summary>
|
||||
public static string AppBarButtonText
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("AppBarButtonText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to menu item.
|
||||
/// </summary>
|
||||
public static string AppBarMenuItemText
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("AppBarMenuItemText", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
137
IF.Lastfm.Demo.Apollo/Resources/AppResources.resx
Normal file
@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ResourceFlowDirection" xml:space="preserve">
|
||||
<value>LeftToRight</value>
|
||||
<comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
|
||||
</data>
|
||||
<data name="ResourceLanguage" xml:space="preserve">
|
||||
<value>en-US</value>
|
||||
<comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
|
||||
</data>
|
||||
<data name="ApplicationTitle" xml:space="preserve">
|
||||
<value>MY APPLICATION</value>
|
||||
</data>
|
||||
<data name="AppBarButtonText" xml:space="preserve">
|
||||
<value>add</value>
|
||||
</data>
|
||||
<data name="AppBarMenuItemText" xml:space="preserve">
|
||||
<value>Menu Item</value>
|
||||
</data>
|
||||
</root>
|
48
IF.Lastfm.Demo.Apollo/TestPages/Scrobbling.xaml
Normal file
@ -0,0 +1,48 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="IF.Lastfm.Demo.Apollo.TestPages.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"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:behaviors="clr-namespace:Cimbalino.Phone.Toolkit.Behaviors;assembly=Cimbalino.Phone.Toolkit"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
xmlns:testPages="clr-namespace:IF.Lastfm.Demo.Apollo.TestPages"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True"
|
||||
d:DataContext="{d:DesignInstance testPages:ScrobblingTestViewModel, IsDesignTimeCreatable=True}">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<behaviors:MultiApplicationBarBehavior x:Name="MultiApplicationBar">
|
||||
<behaviors:ApplicationBar>
|
||||
<behaviors:ApplicationBarIconButton Click="OnDoneClick"
|
||||
IconUri="/Toolkit.Content/ApplicationBar.Check.png"
|
||||
Text="done" />
|
||||
</behaviors:ApplicationBar>
|
||||
</behaviors:MultiApplicationBarBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<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="scrobbling" Margin="9,-7,0,12" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
|
||||
<toolkit:PhoneTextBox Hint="Artist" Text="{Binding Artist, Mode=TwoWay}"/>
|
||||
<toolkit:PhoneTextBox Hint="Track" Text="{Binding Track, Mode=TwoWay}"/>
|
||||
<toolkit:PhoneTextBox Hint="Album" Text="{Binding Album, Mode=TwoWay}"/>
|
||||
<toolkit:PhoneTextBox Hint="Album artist" Text="{Binding AlbumArtist, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
180
IF.Lastfm.Demo.Apollo/TestPages/Scrobbling.xaml.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Cimbalino.Phone.Toolkit.Services;
|
||||
using IF.Lastfm.Core.Api;
|
||||
using IF.Lastfm.Demo.Apollo.Annotations;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace IF.Lastfm.Demo.Apollo.TestPages
|
||||
{
|
||||
public partial class Scrobbling : PhoneApplicationPage
|
||||
{
|
||||
private ScrobblingTestViewModel _viewModel;
|
||||
|
||||
public Scrobbling()
|
||||
{
|
||||
_viewModel = new ScrobblingTestViewModel();
|
||||
|
||||
DataContext = _viewModel;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
MultiApplicationBar.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void OnDoneClick(object sender, EventArgs e)
|
||||
{
|
||||
_viewModel.Scrobble().AsAsyncAction();
|
||||
}
|
||||
}
|
||||
|
||||
public class BaseViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
public class ScrobblingTestViewModel : BaseViewModel
|
||||
{
|
||||
private string _track;
|
||||
private string _albumArtist;
|
||||
private string _artist;
|
||||
private string _album;
|
||||
private bool _inProgress;
|
||||
private bool _successful;
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool InProgress
|
||||
{
|
||||
get { return _inProgress; }
|
||||
set
|
||||
{
|
||||
if (value.Equals(_inProgress))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_inProgress = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Successful
|
||||
{
|
||||
get { return _successful; }
|
||||
set
|
||||
{
|
||||
if (value.Equals(_successful))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_successful = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Artist
|
||||
{
|
||||
get { return _artist; }
|
||||
set
|
||||
{
|
||||
if (value == _artist)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_artist = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Album
|
||||
{
|
||||
get { return _album; }
|
||||
set
|
||||
{
|
||||
if (value == _album)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_album = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Track
|
||||
{
|
||||
get { return _track; }
|
||||
set
|
||||
{
|
||||
if (value == _track)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_track = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string AlbumArtist
|
||||
{
|
||||
get { return _albumArtist; }
|
||||
set
|
||||
{
|
||||
if (value == _albumArtist)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_albumArtist = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public async Task Scrobble()
|
||||
{
|
||||
InProgress = true;
|
||||
|
||||
var appsettings = new ApplicationSettingsService();
|
||||
|
||||
var apikey = appsettings.Get<string>("apikey");
|
||||
var apisecret = appsettings.Get<string>("apisecret");
|
||||
var username = appsettings.Get<string>("username");
|
||||
var pass = appsettings.Get<string>("pass");
|
||||
|
||||
var auth = new Auth(apikey, apisecret);
|
||||
await auth.GetSessionTokenAsync(username, pass);
|
||||
|
||||
var trackApi = new TrackApi(auth);
|
||||
|
||||
var scrobble = new Scrobble(Artist, Album, Track, DateTime.UtcNow, AlbumArtist);
|
||||
|
||||
var response = await trackApi.ScrobbleAsync(scrobble);
|
||||
|
||||
Successful = response.Success;
|
||||
|
||||
InProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
BIN
IF.Lastfm.Demo.Apollo/Toolkit.Content/ApplicationBar.Cancel.png
Normal file
After Width: | Height: | Size: 350 B |
BIN
IF.Lastfm.Demo.Apollo/Toolkit.Content/ApplicationBar.Check.png
Normal file
After Width: | Height: | Size: 414 B |
BIN
IF.Lastfm.Demo.Apollo/Toolkit.Content/ApplicationBar.Delete.png
Normal file
After Width: | Height: | Size: 445 B |
BIN
IF.Lastfm.Demo.Apollo/Toolkit.Content/ApplicationBar.Select.png
Normal file
After Width: | Height: | Size: 863 B |
10
IF.Lastfm.Demo.Apollo/packages.config
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Cimbalino.Phone.Toolkit" version="3.0.0" targetFramework="wp80" />
|
||||
<package id="Cimbalino.Phone.Toolkit.Background" version="3.0.0" targetFramework="wp80" />
|
||||
<package id="Cimbalino.Phone.Toolkit.Controls" version="3.0.0" targetFramework="wp80" />
|
||||
<package id="Microsoft.Bcl" version="1.0.19" targetFramework="wp80" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="wp80" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.7" targetFramework="wp80" />
|
||||
<package id="WPToolkit" version="4.2013.06.11" targetFramework="wp80" />
|
||||
</packages>
|
@ -13,24 +13,60 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{81B53C
|
||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IF.Lastfm.Demo.Apollo", "IF.Lastfm.Demo.Apollo\IF.Lastfm.Demo.Apollo.csproj", "{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{EC1526C6-AE22-4F12-8640-F9613DFCCE1A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{C4B8883C-757A-4952-81D0-34221BAABB67}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{146087E5-B995-4BA1-9E4C-AD332BDDB2EF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|x86.Build.0 = Debug|x86
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|ARM.Build.0 = Release|ARM
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|x86.ActiveCfg = Release|x86
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|x86.Build.0 = Release|x86
|
||||
{3B3CF5ED-2107-4BFA-9E0E-BCB8260C174B}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
2
IF.Lastfm.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=IF_002ELastfm_002EDemo_002EApollo_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|