From 1e72356768079c2d8e029615a66ad3dcb27a9d51 Mon Sep 17 00:00:00 2001 From: Mikko Piipponen Date: Tue, 22 Oct 2013 11:38:59 +0300 Subject: [PATCH] Version 1.1 Use device resolution specific images. Support NuGet Package Restore. --- MusicExplorer/AboutPage.xaml | 2 +- MusicExplorer/Models/ArtistModel.cs | 2 +- MusicExplorer/Models/MixModel.cs | 2 +- MusicExplorer/Models/ProductModel.cs | 2 +- MusicExplorer/MusicExplorer.csproj | 7 +- MusicExplorer/Properties/AssemblyInfo.cs | 4 +- MusicExplorer/Properties/WMAppManifest.xml | 4 +- MusicExplorer/ResolutionHelper.cs | 79 ++++++++++++++++++++++ README.md | 28 ++++---- packages/repositories.config | 4 -- 10 files changed, 101 insertions(+), 33 deletions(-) create mode 100644 MusicExplorer/ResolutionHelper.cs delete mode 100644 packages/repositories.config diff --git a/MusicExplorer/AboutPage.xaml b/MusicExplorer/AboutPage.xaml index 0f67acb..04b2c27 100644 --- a/MusicExplorer/AboutPage.xaml +++ b/MusicExplorer/AboutPage.xaml @@ -70,7 +70,7 @@ - + diff --git a/MusicExplorer/Models/ArtistModel.cs b/MusicExplorer/Models/ArtistModel.cs index 893595b..9c0dc8a 100644 --- a/MusicExplorer/Models/ArtistModel.cs +++ b/MusicExplorer/Models/ArtistModel.cs @@ -160,7 +160,7 @@ public Uri ThumbUri { get { - if (_thumb320Uri != null) + if (_thumb320Uri != null && ResolutionHelper.CurrentResolution == Resolutions.HD1080p) { return _thumb320Uri; } diff --git a/MusicExplorer/Models/MixModel.cs b/MusicExplorer/Models/MixModel.cs index fdefd3c..a2fb2ae 100644 --- a/MusicExplorer/Models/MixModel.cs +++ b/MusicExplorer/Models/MixModel.cs @@ -160,7 +160,7 @@ public Uri ThumbUri { get { - if (_thumb320Uri != null) + if (_thumb320Uri != null && ResolutionHelper.CurrentResolution == Resolutions.HD1080p) { return _thumb320Uri; } diff --git a/MusicExplorer/Models/ProductModel.cs b/MusicExplorer/Models/ProductModel.cs index 627a542..c1dc065 100644 --- a/MusicExplorer/Models/ProductModel.cs +++ b/MusicExplorer/Models/ProductModel.cs @@ -202,7 +202,7 @@ public Uri ThumbUri { get { - if (_thumb320Uri != null) + if (_thumb320Uri != null && ResolutionHelper.CurrentResolution == Resolutions.HD1080p) { return _thumb320Uri; } diff --git a/MusicExplorer/MusicExplorer.csproj b/MusicExplorer/MusicExplorer.csproj index b9a4f32..2a92ac2 100644 --- a/MusicExplorer/MusicExplorer.csproj +++ b/MusicExplorer/MusicExplorer.csproj @@ -114,6 +114,7 @@ + True True @@ -185,12 +186,6 @@ - - - - - - PreserveNewest diff --git a/MusicExplorer/Properties/AssemblyInfo.cs b/MusicExplorer/Properties/AssemblyInfo.cs index f344037..abe919c 100644 --- a/MusicExplorer/Properties/AssemblyInfo.cs +++ b/MusicExplorer/Properties/AssemblyInfo.cs @@ -43,6 +43,6 @@ // // 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.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/MusicExplorer/Properties/WMAppManifest.xml b/MusicExplorer/Properties/WMAppManifest.xml index 4a4b0a1..c8569ea 100644 --- a/MusicExplorer/Properties/WMAppManifest.xml +++ b/MusicExplorer/Properties/WMAppManifest.xml @@ -1,7 +1,7 @@  - + Assets\ApplicationIcon.png @@ -44,7 +44,7 @@ - + \ No newline at end of file diff --git a/MusicExplorer/ResolutionHelper.cs b/MusicExplorer/ResolutionHelper.cs new file mode 100644 index 0000000..05ddbdb --- /dev/null +++ b/MusicExplorer/ResolutionHelper.cs @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2013 Nokia Corporation. All rights reserved. + * + * Nokia, Nokia Connecting People, Nokia Developer, and HERE are trademarks + * and/or registered trademarks of Nokia Corporation. Other product and company + * names mentioned herein may be trademarks or trade names of their respective + * owners. + * + * See the license text file delivered with this project for more information. + */ + +using Microsoft.Phone.Info; +using System; +using System.Windows; + +namespace MusicExplorer +{ + public enum Resolutions { WVGA, WXGA, HD720p, HD1080p }; + + public static class ResolutionHelper + { + static private Size _size; + + private static bool IsWvga + { + get + { + return App.Current.Host.Content.ScaleFactor == 100; + } + } + + private static bool IsWxga + { + get + { + return App.Current.Host.Content.ScaleFactor == 160; + } + } + + private static bool Is720p + { + get + { + return (App.Current.Host.Content.ScaleFactor == 150 && !Is1080p); + } + } + + private static bool Is1080p + { + get + { + if (_size.Width == 0) + { + try + { + _size = (Size)DeviceExtendedProperties.GetValue("PhysicalScreenResolution"); + } + catch (Exception) + { + _size.Width = 0; + } + } + return _size.Width == 1080; + } + } + + public static Resolutions CurrentResolution + { + get + { + if (IsWvga) return Resolutions.WVGA; + else if (IsWxga) return Resolutions.WXGA; + else if (Is720p) return Resolutions.HD720p; + else if (Is1080p) return Resolutions.HD1080p; + else throw new InvalidOperationException("Unknown resolution"); + } + } + } +} diff --git a/README.md b/README.md index 024f9b2..82dd1f4 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Music API related features by trying out the application. * Windows Phone 8 -Tested to work on Nokia Lumia 920. +Tested to work on Nokia Lumia 920 and Nokia Lumia 1520. Developed with Microsoft Visual Studio Express for Windows Phone 2012. 4.1 Required Capabilities @@ -115,25 +115,16 @@ None. Make sure you have the following installed: * Windows 8 * Windows Phone SDK 8.0 - * NuGet 2.1 (https://nuget.org/), Visual Studio extension to install and - update third-party libraries and tools in Visual Studio + * Latest NuGet Package Manager (>2.7.1) from https://nuget.org/ to enable + NuGet Package Restore 5.2 Using the WINDOWS PHONE 8 SDK --------------------------------- 1. Open the SLN file: File > Open Project, select the file MusicExplorer.sln -2. Install Silverlight Toolkit for the project. - * Right click References in Solution Explorer -> select Manage NuGet Packages - * Search for 'wptoolkit' and install the 'Windows Phone toolkit' package -3. Install Nokia Music API for the project. - * Right click References in Solution Explorer -> select Manage NuGet Packages - * Search for 'nokia music' and install the 'Nokia Music' package -4. Install Json.NET for the project. - * Right click References in Solution Explorer -> select Manage NuGet Packages - * Search for 'json' and install the 'Json.NET' package -5. Select the target 'Emulator WXGA'. -6. Press F5 to build the project and run it on the Windows Phone Emulator. +2. Select the target 'Emulator WXGA'. +3. Press F5 to build the project and run it on the Windows Phone Emulator. 5.3 Deploying to Windows Phone 8 -------------------------------- @@ -191,14 +182,21 @@ http://msdn.microsoft.com/en-us/library/gg588378%28v=vs.92%29.aspx 7. Related documentation ------------------------------------------------------------------------------- -An article "Nokia Music API" published on Nokia Lumia Developer's Library +"Nokia Music API" documentation published on Nokia Lumia Developer's Library (http://www.developer.nokia.com/Resources/Library/Lumia/#!nokia-music-api.html) describes the properties and usage of Nokia Music API in detail. +“Optimising for Nokia phablets” documentation on Nokia Lumia Developer's Library +(http://developer.nokia.com/Resources/Library/Lumia/#!optimising-for-nokia-phablets.html) +describes how to optimize applications for large screen, different aspect +ratios, and multiple resolutions. 8. Version history ------------------------------------------------------------------------------- +* 1.1.0.0 Major UI-rework (new tile based design replacing list based design, + utilizing images of higher resolution in 1080p devices and NuGet + package restore support. * 1.0.1.0 Bug fix to handle exception when location is set off * 1.0.0.0 First release * 0.4.0.0 Minor fixes diff --git a/packages/repositories.config b/packages/repositories.config deleted file mode 100644 index a696750..0000000 --- a/packages/repositories.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file