WindowsPhone WeatherInformation
authorGustavo Martin <gu.martinm@gmail.com>
Sat, 5 Jul 2014 10:14:38 +0000 (12:14 +0200)
committerGustavo Martin <gu.martinm@gmail.com>
Sat, 5 Jul 2014 10:14:38 +0000 (12:14 +0200)
Retrieving remote JSON data

15 files changed:
WindowsPhone/WeatherInformation/WeatherInformation/MapPage.xaml.cs
WindowsPhone/WeatherInformation/WeatherInformation/Model/JsonDataParser/JsonParser.cs
WindowsPhone/WeatherInformation/WeatherInformation/Model/Services/CustomHTTPClient.cs [new file with mode: 0644]
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.Designer.cs
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.resx
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.es.xlf
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.resx
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.qps-ploc.xlf
WindowsPhone/WeatherInformation/WeatherInformation/Resources/AppResources.resx
WindowsPhone/WeatherInformation/WeatherInformation/SettingsPage.xaml
WindowsPhone/WeatherInformation/WeatherInformation/SettingsPage.xaml.cs
WindowsPhone/WeatherInformation/WeatherInformation/ViewModels/MainViewModel.cs
WindowsPhone/WeatherInformation/WeatherInformation/ViewModels/SettingsViewModel.cs
WindowsPhone/WeatherInformation/WeatherInformation/WeatherInformation.csproj
WindowsPhone/WeatherInformation/WeatherInformation/packages.config

index 3d37029..56622c3 100644 (file)
@@ -13,38 +13,45 @@ using System.Device.Location;
 using System.Windows.Shapes;
 using System.Windows.Media;
 using Microsoft.Phone.Maps.Controls;
+using WeatherInformation.Resources;
 
 namespace WeatherInformation
 {
     public partial class MapPage : PhoneApplicationPage
     {
+        // Settings
+        private readonly IsolatedStorageSettings _settings;
+
         public MapPage()
         {
             InitializeComponent();
+
+            // Get the _settings for this application.
+            _settings = IsolatedStorageSettings.ApplicationSettings;
         }
 
         protected override void OnNavigatedTo(NavigationEventArgs e)
         {
-            if (!IsolatedStorageSettings.ApplicationSettings.Contains("LocationConsent"))
+            if (!_settings.Contains("LocationConsent"))
             {
-                MessageBoxResult result =
-                    MessageBox.Show("This app accesses your phone's location. Is that ok?",
-                    "Location",
+                MessageBoxResult result = MessageBox.Show(
+                    AppResources.AskForLocationConsentMessageBox,
+                    AppResources.AskForLocationConsentMessageBoxCaption,
                     MessageBoxButton.OKCancel);
 
                 if (result == MessageBoxResult.OK)
                 {
-                    IsolatedStorageSettings.ApplicationSettings["LocationConsent"] = true;
+                    _settings["LocationConsent"] = true;
                 }
                 else
                 {
-                    IsolatedStorageSettings.ApplicationSettings["LocationConsent"] = false;
+                    _settings["LocationConsent"] = false;
                 }
 
-                IsolatedStorageSettings.ApplicationSettings.Save();
+                _settings.Save();
             }
 
-            if ((bool)IsolatedStorageSettings.ApplicationSettings["LocationConsent"] != true)
+            if ((bool)_settings["LocationConsent"] != true)
             {
                 // The user has opted out of Location.
                 return;
@@ -89,21 +96,27 @@ namespace WeatherInformation
                 // Add the MapLayer to the Map.
                 this.mapWeatherInformation.Layers.Add(myLocationLayer);
 
-                
-
-                //LatitudeTextBlock.Text = geoposition.Coordinate.Latitude.ToString("0.00");
-                //LongitudeTextBlock.Text = geoposition.Coordinate.Longitude.ToString("0.00");
+                _settings["CurrentLatitude"] = myGeoCoordinate.Latitude;
+                _settings["CurrentLongitude"] = myGeoCoordinate.Longitude;
             }
             catch (Exception ex)
             {
                 if ((uint)ex.HResult == 0x80004004)
                 {
+
                     // the application does not have the right capability or the location master switch is off
-                    //StatusTextBlock.Text = "location  is disabled in phone settings.";
+                    MessageBox.Show(
+                        AppResources.NoticeErrorLocationAutodetection,
+                        AppResources.AskForLocationConsentMessageBoxCaption,
+                        MessageBoxButton.OK);
                 }
-                //else
+                else
                 {
                     // something else happened acquring the location
+                    MessageBox.Show(
+                        AppResources.NoticeErrorLocationAutodetection,
+                        AppResources.AskForLocationConsentMessageBoxCaption,
+                        MessageBoxButton.OK);
                 }
             }
         }
index 3f077cb..326cf0e 100644 (file)
@@ -8,7 +8,7 @@ namespace WeatherInformation.Model.JsonDataParser
     class JsonParser
     {
         /// <summary>
-        /// The _json settings.
+        /// The _json _settings.
         /// </summary>
         private static readonly JsonSerializerSettings _jsonSettings =
             new JsonSerializerSettings
diff --git a/WindowsPhone/WeatherInformation/WeatherInformation/Model/Services/CustomHTTPClient.cs b/WindowsPhone/WeatherInformation/WeatherInformation/Model/Services/CustomHTTPClient.cs
new file mode 100644 (file)
index 0000000..083959f
--- /dev/null
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WeatherInformation.Model.Services
+{
+    class CustomHTTPClient
+    {
+        async public Task<string> getWeatherData(string url)
+        {
+            using (HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(30) })
+            {
+                return await client.GetStringAsync(url);
+            }
+        } 
+    }  
+}
index 68019f7..3b12d42 100644 (file)
@@ -61,6 +61,15 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
+        ///   Busca una cadena traducida similar a 2.5.
+        /// </summary>
+        public static string APIVersionOpenWeatherMap {
+            get {
+                return ResourceManager.GetString("APIVersionOpenWeatherMap", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Busca una cadena traducida similar a add.
         /// </summary>
         public static string AppBarButtonText {
@@ -88,6 +97,42 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
+        ///   Busca una cadena traducida similar a This app accesses your phone&apos;s location. Is that ok?.
+        /// </summary>
+        public static string AskForLocationConsentMessageBox {
+            get {
+                return ResourceManager.GetString("AskForLocationConsentMessageBox", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a Location.
+        /// </summary>
+        public static string AskForLocationConsentMessageBoxCaption {
+            get {
+                return ResourceManager.GetString("AskForLocationConsentMessageBoxCaption", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a Location autodetection seems to be disabled in your phone.
+        /// </summary>
+        public static string NoticeErrorLocationAutodetection {
+            get {
+                return ResourceManager.GetString("NoticeErrorLocationAutodetection", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a There is not stored locations..
+        /// </summary>
+        public static string NoticeThereIsNotCurrentLocation {
+            get {
+                return ResourceManager.GetString("NoticeThereIsNotCurrentLocation", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Busca una cadena traducida similar a LeftToRight.
         /// </summary>
         public static string ResourceFlowDirection {
@@ -106,6 +151,42 @@ namespace WeatherInformation.Resources {
         }
         
         /// <summary>
+        ///   Busca una cadena traducida similar a Forecast day numbers.
+        /// </summary>
+        public static string SettingsForecastDayNumbersHeader {
+            get {
+                return ResourceManager.GetString("SettingsForecastDayNumbersHeader", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a 5-Day Forecast.
+        /// </summary>
+        public static string SettingsForecastDayNumbersSelectionFive {
+            get {
+                return ResourceManager.GetString("SettingsForecastDayNumbersSelectionFive", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a 14-Day Forecast.
+        /// </summary>
+        public static string SettingsForecastDayNumbersSelectionFourteen {
+            get {
+                return ResourceManager.GetString("SettingsForecastDayNumbersSelectionFourteen", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a 10-Day Forecast.
+        /// </summary>
+        public static string SettingsForecastDayNumbersSelectionTen {
+            get {
+                return ResourceManager.GetString("SettingsForecastDayNumbersSelectionTen", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Busca una cadena traducida similar a Language.
         /// </summary>
         public static string SettingsLanguageHeader {
@@ -158,5 +239,32 @@ namespace WeatherInformation.Resources {
                 return ResourceManager.GetString("SettingsTemperatureUnitsSelectionFahrenheit", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a ºC.
+        /// </summary>
+        public static string TemperatureUnitsCentigradeSymbol {
+            get {
+                return ResourceManager.GetString("TemperatureUnitsCentigradeSymbol", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a ºF.
+        /// </summary>
+        public static string TemperatureUnitsFahrenheitSymbol {
+            get {
+                return ResourceManager.GetString("TemperatureUnitsFahrenheitSymbol", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&amp;lon={2}&amp;cnt={3}&amp;mode=json.
+        /// </summary>
+        public static string URIAPIOpenWeatherMapForecast {
+            get {
+                return ResourceManager.GetString("URIAPIOpenWeatherMapForecast", resourceCulture);
+            }
+        }
     }
 }
index 621209a..65748f3 100644 (file)
   
   
   
-<data name="ApplicationTitle" xml:space="preserve"><value>MI APLICACIÓN</value></data><data name="AppBarButtonText" xml:space="preserve"><value>Agregar</value></data><data name="AppBarMenuItemText" xml:space="preserve"><value>Elemento de menú</value></data><data name="SettingsLanguageHeader" xml:space="preserve"><value>Idioma</value><comment>Text in settings page</comment></data><data name="SettingsTemperatureUnitsHeader" xml:space="preserve"><value>Unidades de temperatura</value><comment>Text in settings page</comment></data><data name="SettingsLanguageSelectionEnglish" xml:space="preserve"><value>inglés</value><comment>Settings page, select English language</comment></data><data name="SettingsLanguageSelectionSpanish" xml:space="preserve"><value>español</value><comment>Settings page, select Spanish language</comment></data><data name="SettingsTemperatureUnitsSelectionCentigrade" xml:space="preserve"><value>celsius</value><comment>Settings page, select tempereature units centigrade</comment></data><data name="SettingsTemperatureUnitsSelectionFahrenheit" xml:space="preserve"><value>fahrenheit</value><comment>Settings page, select temperature units fahrenheit</comment></data></root>
\ No newline at end of file
+<data name="ApplicationTitle" xml:space="preserve"><value>MI APLICACIÓN</value></data><data name="AppBarButtonText" xml:space="preserve"><value>Agregar</value></data><data name="AppBarMenuItemText" xml:space="preserve"><value>Elemento de menú</value></data><data name="SettingsLanguageHeader" xml:space="preserve"><value>Idioma</value><comment>Text in settings page as header</comment></data><data name="SettingsTemperatureUnitsHeader" xml:space="preserve"><value>Unidades de temperatura</value><comment>Text in settings page</comment></data><data name="SettingsLanguageSelectionEnglish" xml:space="preserve"><value>inglés</value><comment>Settings page, select English language</comment></data><data name="SettingsLanguageSelectionSpanish" xml:space="preserve"><value>español</value><comment>Settings page, select Spanish language</comment></data><data name="SettingsTemperatureUnitsSelectionCentigrade" xml:space="preserve"><value>celsius</value><comment>Settings page, select tempereature units centigrade</comment></data><data name="SettingsTemperatureUnitsSelectionFahrenheit" xml:space="preserve"><value>fahrenheit</value><comment>Settings page, select temperature units fahrenheit</comment></data></root>
\ No newline at end of file
index 6f829c2..f413a74 100644 (file)
@@ -31,7 +31,7 @@
         <trans-unit id="Resx/SettingsLanguageHeader" translate="yes" xml:space="preserve">
           <source>Language</source>
           <target state="needs-review-translation" state-qualifier="mt-suggestion">Idioma</target>
-          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page</note>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page as header</note>
           </trans-unit>
         <trans-unit id="Resx/SettingsTemperatureUnitsHeader" translate="yes" xml:space="preserve">
           <source>Temperature units</source>
           <target state="translated">fahrenheit</target>
           <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select temperature units fahrenheit</note>
           </trans-unit>
+        <trans-unit id="Resx/AskForLocationConsentMessageBoxCaption" translate="yes" xml:space="preserve">
+          <source>Location</source>
+          <target state="new">Location</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Ask for location consent in map window</note>
+        </trans-unit>
+        <trans-unit id="Resx/NoticeThereIsNotCurrentLocation" translate="yes" xml:space="preserve">
+          <source>There is not stored locations.</source>
+          <target state="new">There is not stored locations.</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Main window, notice message, no available locations</note>
+        </trans-unit>
+        <trans-unit id="Resx/NoticeErrorLocationAutodetection" translate="yes" xml:space="preserve">
+          <source>Location autodetection seems to be disabled in your phone</source>
+          <target state="new">Location autodetection seems to be disabled in your phone</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Map window, notice message, error while location autodetection</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersHeader" translate="yes" xml:space="preserve">
+          <source>Forecast day numbers</source>
+          <target state="new">Forecast day numbers</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page as header</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersSelectionTen" translate="yes" xml:space="preserve">
+          <source>10-Day Forecast</source>
+          <target state="new">10-Day Forecast</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select forecast day numbers</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersSelectionFourteen" translate="yes" xml:space="preserve">
+          <source>14-Day Forecast</source>
+          <target state="new">14-Day Forecast</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select forecast day numbers</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersSelectionFive" translate="yes" xml:space="preserve">
+          <source>5-Day Forecast</source>
+          <target state="new">5-Day Forecast</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select forecast day numbers</note>
+        </trans-unit>
+        <trans-unit id="Resx/TemperatureUnitsFahrenheitSymbol" translate="yes" xml:space="preserve">
+          <source>ºF</source>
+          <target state="new">ºF</target>
+        </trans-unit>
+        <trans-unit id="Resx/TemperatureUnitsCentigradeSymbol" translate="yes" xml:space="preserve">
+          <source>ºC</source>
+          <target state="new">ºC</target>
+        </trans-unit>
+        <trans-unit id="Resx/AskForLocationConsentMessageBox" translate="yes" xml:space="preserve">
+          <source>This app accesses your phone's location. Is that ok?</source>
+          <target state="new">This app accesses your phone's location. Is that ok?</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Ask for location consent in map window</note>
+        </trans-unit>
+        <trans-unit id="Resx/APIVersionOpenWeatherMap" translate="yes" xml:space="preserve">
+          <source>2.5</source>
+          <target state="new">2.5</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Not to be translated.</note>
+        </trans-unit>
+        <trans-unit id="Resx/URIAPIOpenWeatherMapForecast" translate="yes" xml:space="preserve">
+          <source>http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}%%amp;lon={2}%%amp;cnt={3}%%amp;mode=json</source>
+          <target state="new">http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}%%amp;lon={2}%%amp;cnt={3}%%amp;mode=json</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Not to be translated.</note>
+        </trans-unit>
       </group>
     </body>
   </file>
index a363470..be39ccb 100644 (file)
   </data>
   <data name="SettingsLanguageHeader" xml:space="preserve">
     <value>[D9E46][!!_Ļàйģûáğè_!!]</value>
-    <comment>Text in settings page</comment>
+    <comment>Text in settings page as header</comment>
   </data>
   <data name="SettingsTemperatureUnitsHeader" xml:space="preserve">
     <value>[27946][!!_Ţêmþêŗáτúřê ûиìтş_!!]</value>
index 807e3b2..d4361fe 100644 (file)
           <target state="needs-review-translation" state-qualifier="mt-suggestion">[9AF14][!!_ƒáĥřêηĥęîţ_!!]</target>
           <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select temperature units fahrenheit</note>
           </trans-unit>
+        <trans-unit id="Resx/AskForLocationConsentMessageBoxCaption" translate="yes" xml:space="preserve">
+          <source>Location</source>
+          <target state="new">Location</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Ask for location consent in map window</note>
+        </trans-unit>
+        <trans-unit id="Resx/NoticeThereIsNotCurrentLocation" translate="yes" xml:space="preserve">
+          <source>There is not stored locations.</source>
+          <target state="new">There is not stored locations.</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Main window, notice message, no available locations</note>
+        </trans-unit>
+        <trans-unit id="Resx/NoticeErrorLocationAutodetection" translate="yes" xml:space="preserve">
+          <source>Location autodetection seems to be disabled in your phone</source>
+          <target state="new">Location autodetection seems to be disabled in your phone</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Map window, notice message, error while location autodetection</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersHeader" translate="yes" xml:space="preserve">
+          <source>Forecast day numbers</source>
+          <target state="new">Forecast day numbers</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page as header</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersSelectionTen" translate="yes" xml:space="preserve">
+          <source>10-Day Forecast</source>
+          <target state="new">10-Day Forecast</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select forecast day numbers</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersSelectionFourteen" translate="yes" xml:space="preserve">
+          <source>14-Day Forecast</source>
+          <target state="new">14-Day Forecast</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select forecast day numbers</note>
+        </trans-unit>
+        <trans-unit id="Resx/SettingsForecastDayNumbersSelectionFive" translate="yes" xml:space="preserve">
+          <source>5-Day Forecast</source>
+          <target state="new">5-Day Forecast</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Settings page, select forecast day numbers</note>
+        </trans-unit>
+        <trans-unit id="Resx/TemperatureUnitsFahrenheitSymbol" translate="yes" xml:space="preserve">
+          <source>ºF</source>
+          <target state="new">ºF</target>
+        </trans-unit>
+        <trans-unit id="Resx/TemperatureUnitsCentigradeSymbol" translate="yes" xml:space="preserve">
+          <source>ºC</source>
+          <target state="new">ºC</target>
+        </trans-unit>
+        <trans-unit id="Resx/AskForLocationConsentMessageBox" translate="yes" xml:space="preserve">
+          <source>This app accesses your phone's location. Is that ok?</source>
+          <target state="new">This app accesses your phone's location. Is that ok?</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Ask for location consent in map window</note>
+        </trans-unit>
+        <trans-unit id="Resx/APIVersionOpenWeatherMap" translate="yes" xml:space="preserve">
+          <source>2.5</source>
+          <target state="new">2.5</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Not to be translated.</note>
+        </trans-unit>
+        <trans-unit id="Resx/URIAPIOpenWeatherMapForecast" translate="yes" xml:space="preserve">
+          <source>http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}%%amp;lon={2}%%amp;cnt={3}%%amp;mode=json</source>
+          <target state="new">http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}%%amp;lon={2}%%amp;cnt={3}%%amp;mode=json</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">Not to be translated.</note>
+        </trans-unit>
         <trans-unit id="Resx/SettingsTemperatureUnitsSelectionCentigrade" translate="yes" xml:space="preserve">
           <source>celsius</source>
           <target state="needs-review-translation" state-qualifier="mt-suggestion">[EFA86][!!_ćęηťíğŕãďõ_!!]</target>
         <trans-unit id="Resx/SettingsLanguageHeader" translate="yes" xml:space="preserve">
           <source>Language</source>
           <target state="needs-review-translation" state-qualifier="mt-suggestion">[D9E46][!!_Ļàйģûáğè_!!]</target>
-          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page</note>
+          <note from="MultilingualBuild" annotates="source" priority="2">Text in settings page as header</note>
           </trans-unit>
       </group>
     </body>
index 8adccab..39ab410 100644 (file)
   </data>
   <data name="SettingsLanguageHeader" xml:space="preserve">
     <value>Language</value>
-    <comment>Text in settings page</comment>
+    <comment>Text in settings page as header</comment>
   </data>
   <data name="SettingsTemperatureUnitsHeader" xml:space="preserve">
     <value>Temperature units</value>
     <value>fahrenheit</value>
     <comment>Settings page, select temperature units fahrenheit</comment>
   </data>
+  <data name="URIAPIOpenWeatherMapForecast" xml:space="preserve">
+    <value>http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&amp;lon={2}&amp;cnt={3}&amp;mode=json</value>
+    <comment>Not to be translated.</comment>
+  </data>
+  <data name="APIVersionOpenWeatherMap" xml:space="preserve">
+    <value>2.5</value>
+    <comment>Not to be translated.</comment>
+  </data>
+  <data name="AskForLocationConsentMessageBox" xml:space="preserve">
+    <value>This app accesses your phone's location. Is that ok?</value>
+    <comment>Ask for location consent in map window</comment>
+  </data>
+  <data name="AskForLocationConsentMessageBoxCaption" xml:space="preserve">
+    <value>Location</value>
+    <comment>Ask for location consent in map window</comment>
+  </data>
+  <data name="NoticeThereIsNotCurrentLocation" xml:space="preserve">
+    <value>There is not stored locations.</value>
+    <comment>Main window, notice message, no available locations</comment>
+  </data>
+  <data name="NoticeErrorLocationAutodetection" xml:space="preserve">
+    <value>Location autodetection seems to be disabled in your phone</value>
+    <comment>Map window, notice message, error while location autodetection</comment>
+  </data>
+  <data name="SettingsForecastDayNumbersHeader" xml:space="preserve">
+    <value>Forecast day numbers</value>
+    <comment>Text in settings page as header</comment>
+  </data>
+  <data name="SettingsForecastDayNumbersSelectionFive" xml:space="preserve">
+    <value>5-Day Forecast</value>
+    <comment>Settings page, select forecast day numbers</comment>
+  </data>
+  <data name="SettingsForecastDayNumbersSelectionFourteen" xml:space="preserve">
+    <value>14-Day Forecast</value>
+    <comment>Settings page, select forecast day numbers</comment>
+  </data>
+  <data name="SettingsForecastDayNumbersSelectionTen" xml:space="preserve">
+    <value>10-Day Forecast</value>
+    <comment>Settings page, select forecast day numbers</comment>
+  </data>
+  <data name="TemperatureUnitsCentigradeSymbol" xml:space="preserve">
+    <value>ºC</value>
+  </data>
+  <data name="TemperatureUnitsFahrenheitSymbol" xml:space="preserve">
+    <value>ºF</value>
+  </data>
 </root>
\ No newline at end of file
index ea65478..5de48e9 100644 (file)
@@ -34,6 +34,7 @@
                     <Grid.RowDefinitions>
                         <RowDefinition Height="*" />
                         <RowDefinition Height="*" />
+                        <RowDefinition Height="*" />
                     </Grid.RowDefinitions>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*" />
                             <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsLanguageSelectionSpanish, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
                         </toolkit:ListPicker>
                     </StackPanel>
+                    <StackPanel Grid.Column="0" Grid.Row="2" Orientation="Vertical" VerticalAlignment="Center">
+                        <TextBox x:Name="ForecastDayNumbersHeader" Text="{Binding LocalizedResources.SettingsForecastDayNumbersHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2" />
+                        <toolkit:ListPicker x:Name="ForecastDayNumbersSelection" SelectedIndex="{Binding Source={StaticResource SettingsViewModelDataSource}, Path=ForecastDayNumbersSelectionSetting, Mode=TwoWay}" SelectionChanged="ForecastDayNumbersSelection_SelectionChanged">
+                            <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsForecastDayNumbersSelectionFive, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
+                            <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsForecastDayNumbersSelectionTen, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
+                            <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsForecastDayNumbersSelectionFourteen, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
+                        </toolkit:ListPicker>
+                    </StackPanel>
                 </Grid>
             </phone:PivotItem>
 
index bd08d8a..ce2756a 100644 (file)
@@ -51,5 +51,15 @@ namespace WeatherInformation
             var item = listPicker.Items[index];
             listPicker.SelectedItem = item;
         }
+
+        private void ForecastDayNumbersSelection_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            ListPicker listPicker = sender as ListPicker;
+
+            // TODO: with LINQ :(
+            int index = listPicker.SelectedIndex;
+            var item = listPicker.Items[index];
+            listPicker.SelectedItem = item;
+        }
     }
 }
\ No newline at end of file
index 4bf9dee..da91928 100644 (file)
@@ -2,6 +2,9 @@
 using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Globalization;
+using System.IO.IsolatedStorage;
+using System.Threading.Tasks;
+using System.Windows;
 using WeatherInformation.Model.ForecastWeatherParser;
 using WeatherInformation.Model.JsonDataParser;
 using WeatherInformation.Model.Services;
@@ -11,11 +14,28 @@ namespace WeatherInformation.ViewModels
 {
     public class MainViewModel : INotifyPropertyChanged
     {
+        // The key names of _settings
+        // TODO: reuse settings object instead of using the same code here again...
+        private const string _temperatureUnitsSelectionSettingKeyName = "TemperatureUnitsSelection";
+        private const string _forecastDayNumbersSelectionSelectionSettingKeyName = "ForecastDayNumbersSelection";
+
+        // The default value of _settings
+        // TODO: reuse settings object instead of using the same code here again...
+        private const int _temperatureUnitsSelectionSettingDefault = 0;
+        private const int _forecastDayNumbersSelectionSettingDefault = 0;
+
+        // Settings
+        private readonly IsolatedStorageSettings _settings;
+        private readonly ServiceParser _serviceParser;
+
         public MainViewModel()
         {
             this.ForecastItems = new ObservableCollection<ItemViewModel>();
             this.CurrentItems = new ObservableCollection<ItemViewModel>();
             this._serviceParser = new ServiceParser(new JsonParser());
+
+            // Get the _settings for this application.
+            _settings = IsolatedStorageSettings.ApplicationSettings;
         }
 
         /// <summary>
@@ -24,31 +44,7 @@ namespace WeatherInformation.ViewModels
         public ObservableCollection<ItemViewModel> ForecastItems { get; private set; }
         public ObservableCollection<ItemViewModel> CurrentItems { get; private set; }
 
-        private readonly ServiceParser _serviceParser;
-
-        string _jsonForeCastWeatherData =
-    "{"
-    + "\"cod\":\"200\","
-    + "\"message\":0.0048,"
-    + "\"city\":{\"id\":2641549,\"name\":\"Newtonhill\",\"coord\":{\"lon\":-2.15,\"lat\":57.033329},\"country\":\"GB\",\"population\":0},"
-    + "\"cnt\":15,"
-    + "\"list\":["
-    + "{\"dt\":1397304000,\"temp\":{\"day\":286.15,\"min\":284.62,\"max\":286.15,\"night\":284.62,\"eve\":285.7,\"morn\":286.15},\"pressure\":1016.67,\"humidity\":84,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":7.68,\"deg\":252,\"clouds\":0,\"rain\":0.25},"
-    + "{\"dt\":1397390400,\"temp\":{\"day\":284.92,\"min\":282.3,\"max\":284.92,\"night\":282.3,\"eve\":283.79,\"morn\":284.24},\"pressure\":1021.62,\"humidity\":84,\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"speed\":7.91,\"deg\":259,\"clouds\":92},"
-    + "{\"dt\":1397476800,\"temp\":{\"day\":282.1,\"min\":280.32,\"max\":282.1,\"night\":280.32,\"eve\":281.51,\"morn\":281.65},\"pressure\":1033.84,\"humidity\":92,\"weather\":[{\"id\":801,\"main\":\"Clouds\",\"description\":\"few clouds\",\"icon\":\"02d\"}],\"speed\":8.37,\"deg\":324,\"clouds\":20},"
-    + "{\"dt\":1397563200,\"temp\":{\"day\":280.73,\"min\":280.11,\"max\":281.4,\"night\":281.4,\"eve\":280.75,\"morn\":280.11},\"pressure\":1039.27,\"humidity\":97,\"weather\":[{\"id\":801,\"main\":\"Clouds\",\"description\":\"few clouds\",\"icon\":\"02d\"}],\"speed\":7.31,\"deg\":184,\"clouds\":12},"
-    + "{\"dt\":1397649600,\"temp\":{\"day\":281.73,\"min\":281.03,\"max\":282.22,\"night\":281.69,\"eve\":282.22,\"morn\":281.03},\"pressure\":1036.05,\"humidity\":90,\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"speed\":7.61,\"deg\":205,\"clouds\":68},"
-    + "{\"dt\":1397736000,\"temp\":{\"day\":282.9,\"min\":281.45,\"max\":283.21,\"night\":282.71,\"eve\":283.06,\"morn\":281.49},\"pressure\":1029.39,\"humidity\":83,\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"speed\":6.17,\"deg\":268,\"clouds\":56},"
-    + "{\"dt\":1397822400,\"temp\":{\"day\":285.26,\"min\":281.55,\"max\":285.26,\"night\":282.48,\"eve\":285.09,\"morn\":281.55},\"pressure\":1025.83,\"humidity\":0,\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"sky is clear\",\"icon\":\"01d\"}],\"speed\":5.31,\"deg\":221,\"clouds\":10},"
-    + "{\"dt\":1397908800,\"temp\":{\"day\":284.29,\"min\":281.5,\"max\":284.29,\"night\":282.53,\"eve\":283.58,\"morn\":281.5},\"pressure\":1024.55,\"humidity\":0,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":5.51,\"deg\":192,\"clouds\":6},"
-    + "{\"dt\":1397995200,\"temp\":{\"day\":283.36,\"min\":281.62,\"max\":284.34,\"night\":284.04,\"eve\":284.34,\"morn\":281.62},\"pressure\":1019.58,\"humidity\":0,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":7.66,\"deg\":149,\"clouds\":0,\"rain\":0.48},"
-    + "{\"dt\":1398081600,\"temp\":{\"day\":282.24,\"min\":280.51,\"max\":282.41,\"night\":280.51,\"eve\":282.41,\"morn\":280.9},\"pressure\":1027.35,\"humidity\":0,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":8.17,\"deg\":221,\"clouds\":10,\"rain\":0.94},"
-    + "{\"dt\":1398168000,\"temp\":{\"day\":282.28,\"min\":279.76,\"max\":282.28,\"night\":280.69,\"eve\":281.13,\"morn\":279.76},\"pressure\":1038.31,\"humidity\":0,\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"sky is clear\",\"icon\":\"01d\"}],\"speed\":6.33,\"deg\":172,\"clouds\":1},"
-    + "{\"dt\":1398254400,\"temp\":{\"day\":281.54,\"min\":280.52,\"max\":281.54,\"night\":281.44,\"eve\":281.23,\"morn\":280.52},\"pressure\":1022.4,\"humidity\":0,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":7.84,\"deg\":140,\"clouds\":91,\"rain\":1.24},"
-    + "{\"dt\":1398340800,\"temp\":{\"day\":282.1,\"min\":280.66,\"max\":282.78,\"night\":280.97,\"eve\":282.78,\"morn\":280.66},\"pressure\":1013.39,\"humidity\":0,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":9.43,\"deg\":164,\"clouds\":98,\"rain\":1.03},"
-    + "{\"dt\":1398427200,\"temp\":{\"day\":282.11,\"min\":280.72,\"max\":282.32,\"night\":282.32,\"eve\":280.99,\"morn\":280.72},\"pressure\":1018.65,\"humidity\":0,\"weather\":[{\"id\":502,\"main\":\"Rain\",\"description\":\"heavy intensity rain\",\"icon\":\"10d\"}],\"speed\":5.26,\"deg\":158,\"clouds\":83,\"rain\":14.4},"
-    + "{\"dt\":1398513600,\"temp\":{\"day\":282.75,\"min\":280.61,\"max\":282.75,\"night\":280.61,\"eve\":281.75,\"morn\":281.96},\"pressure\":1007.4,\"humidity\":0,\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"speed\":9.18,\"deg\":198,\"clouds\":35,\"rain\":0.55}"
-    + "]}";
+        
 
         public bool IsDataLoaded
         {
@@ -59,27 +55,127 @@ namespace WeatherInformation.ViewModels
         /// <summary>
         /// Crear y agregar unos pocos objetos ItemViewModel a la colección Items.
         /// </summary>
-        public void LoadData()
+        async public Task LoadData()
         {
-            ForecastWeather weather = this._serviceParser.GetForecastWeather(this._jsonForeCastWeatherData);
+            if (!_settings.Contains("CurrentLatitude") || !_settings.Contains("CurrentLongitude"))
+            {
+                 MessageBox.Show(
+                     AppResources.NoticeThereIsNotCurrentLocation,
+                     AppResources.AskForLocationConsentMessageBoxCaption,
+                     MessageBoxButton.OK);
+                return;
+            }
+
+            CustomHTTPClient httpClient = new CustomHTTPClient();
+
+            int resultsNumber = 14;
+            string formattedForecastURL = String.Format(
+                CultureInfo.InvariantCulture, AppResources.URIAPIOpenWeatherMapForecast,
+                AppResources.APIVersionOpenWeatherMap, (double)_settings["CurrentLatitude"],
+                (double)_settings["CurrentLongitude"], resultsNumber);
+            string jsonData = await httpClient.getWeatherData(formattedForecastURL);
+
+            ForecastWeather weather = this._serviceParser.GetForecastWeather(jsonData);
+
+
+            // TODO: there must be a better way than using the index value :(
+            int forecastDayNumbers =
+                    GetValueOrDefault<int>(_forecastDayNumbersSelectionSelectionSettingKeyName, _forecastDayNumbersSelectionSettingDefault);
+            int count;
+            switch(forecastDayNumbers)
+            {
+                case(0):
+                    count = 5;
+                    break;
+                case(1):
+                    count = 10;
+                    break;
+                case(2):
+                    count = 14;
+                    break;
+                default:
+                    count = 14;
+                    break;
+            }
 
             foreach (WeatherInformation.Model.ForecastWeatherParser.List item in weather.list)
             {
+                // TODO: there must be a better way than using the index value :(
+                bool isFahrenheit = true;
+                int temperatureUnitsSelection =
+                    GetValueOrDefault<int>(_temperatureUnitsSelectionSettingKeyName, _temperatureUnitsSelectionSettingDefault);
+                if (temperatureUnitsSelection != 0)
+                {
+                    isFahrenheit = false;
+                }
+                double tempUnits = isFahrenheit ? 0 : 273.15;
+                string symbol = isFahrenheit ? AppResources.TemperatureUnitsFahrenheitSymbol : AppResources.TemperatureUnitsCentigradeSymbol;
+
                 DateTime unixTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                 DateTime date = unixTime.AddSeconds(item.dt).ToLocalTime();
+
+                // TODO: if I do not receive max temp or min temp... Am I going to receive item.temp.max=0 or item.temp.min=0 (I guess because
+                // double has no null value)
+                // I need something that is not 0 value in order to find out if OpenWeatherMap sent me values or not :/
+                // I guess; I am going to need nullable but I will have to modify my Json Parser :(
+                double maxTemp = item.temp.max;
+                maxTemp = maxTemp - tempUnits;
+
+                double minTemp = item.temp.min;
+                minTemp = minTemp - tempUnits;
+
                 this.ForecastItems.Add(new ItemViewModel()
                 {
                     LineOne = date.ToString("ddd", CultureInfo.InvariantCulture),
                     LineTwo = date.ToString("dd", CultureInfo.InvariantCulture),
-                    LineThree = String.Format("{0:0.##}", item.temp.max),
-                    LineFour = String.Format("{0:0.##}", item.temp.min),
+                    LineThree = String.Format(CultureInfo.InvariantCulture, "{0:0.##}", maxTemp) + symbol,
+                    LineFour = String.Format(CultureInfo.InvariantCulture, "{0:0.##}", minTemp) + symbol,
                     LineFive = "/Assets/Tiles/IconicTileMediumLarge.png"
                 });
+
+                count--;
+                if (count == 0)
+                {
+                    break;
+                }
             }
 
             this.IsDataLoaded = true;
         }
 
+        /// <summary>
+        /// Get the current value of the setting, or if it is not found, set the 
+        /// setting to the default value.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="Key"></param>
+        /// <param name="defaultValue"></param>
+        /// <returns></returns>
+        private T GetValueOrDefault<T>(string Key, T defaultValue)
+        {
+            T value;
+
+            // You need to add a check to DesignerProperties.IsInDesignTool to that code since accessing
+            // IsolatedStorageSettings in Visual Studio or Expression Blend is invalid.
+            // see: http://stackoverflow.com/questions/7294461/unable-to-determine-application-identity-of-the-caller
+            if (System.ComponentModel.DesignerProperties.IsInDesignTool)
+            {
+                return defaultValue;
+            }
+
+            // If the key exists, retrieve the value.
+            if (_settings.Contains(Key))
+            {
+                value = (T)_settings[Key];
+            }
+            // Otherwise, use the default value.
+            else
+            {
+                value = defaultValue;
+            }
+            return value;
+        }
+
         public event PropertyChangedEventHandler PropertyChanged;
         private void NotifyPropertyChanged(String propertyName)
         {
index ef6d94c..ce56db2 100644 (file)
@@ -12,18 +12,22 @@ using WeatherInformation.Resources;
 
 namespace WeatherInformation.ViewModels
 {
+    // TODO: to use this class or something like that in every place of this application where the settings must be retrieved!!!
+    // (do not copy-paste code!!!)
     public class SettingsViewModel
     {
         // Settings
-        private IsolatedStorageSettings settings;
+        private readonly IsolatedStorageSettings _settings;
 
-        // The key names of settings
+        // The key names of _settings
         private const string _languageSelectionSettingKeyName = "LanguageSelection";
         private const string _temperatureUnitsSelectionSettingKeyName = "TemperatureUnitsSelection";
+        private const string _forecastDayNumbersSelectionSelectionSettingKeyName = "ForecastDayNumbersSelection";
 
-        // The default value of ListPicker settings
+        // The default value of ListPicker _settings
         private const int _languageSelectionSettingDefault = 0;
-        private const int _temperatureUnitsSelectionSettinDefault = 0;
+        private const int _temperatureUnitsSelectionSettingDefault = 0;
+        private const int _forecastDayNumbersSelectionSettingDefault = 0;
 
 
         public SettingsViewModel()
@@ -33,8 +37,8 @@ namespace WeatherInformation.ViewModels
             // see: http://stackoverflow.com/questions/7294461/unable-to-determine-application-identity-of-the-caller
             if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
             {
-                // Get the settings for this application.
-                settings = IsolatedStorageSettings.ApplicationSettings;
+                // Get the _settings for this application.
+                _settings = IsolatedStorageSettings.ApplicationSettings;
             }
         }
 
@@ -63,7 +67,7 @@ namespace WeatherInformation.ViewModels
         {
             get
             {
-                return GetValueOrDefault<int>(_temperatureUnitsSelectionSettingKeyName, _temperatureUnitsSelectionSettinDefault);
+                return GetValueOrDefault<int>(_temperatureUnitsSelectionSettingKeyName, _temperatureUnitsSelectionSettingDefault);
             }
             set
             {
@@ -75,6 +79,24 @@ namespace WeatherInformation.ViewModels
         }
 
         /// <summary>
+        /// Property to get and set forecast day numbers selection Setting Key.
+        /// </summary>
+        public int ForecastDayNumbersSelectionSetting
+        {
+            get
+            {
+                return GetValueOrDefault<int>(_forecastDayNumbersSelectionSelectionSettingKeyName, _forecastDayNumbersSelectionSettingDefault);
+            }
+            set
+            {
+                if (AddOrUpdateValue(_forecastDayNumbersSelectionSelectionSettingKeyName, value))
+                {
+                    Save();
+                }
+            }
+        }
+
+        /// <summary>
         /// Get the current value of the setting, or if it is not found, set the 
         /// setting to the default value.
         /// </summary>
@@ -95,9 +117,9 @@ namespace WeatherInformation.ViewModels
             }
 
             // If the key exists, retrieve the value.
-            if (settings.Contains(Key))
+            if (_settings.Contains(Key))
             {
-                value = (T)settings[Key];
+                value = (T)_settings[Key];
             }
             // Otherwise, use the default value.
             else
@@ -127,27 +149,27 @@ namespace WeatherInformation.ViewModels
             }
 
             // If the key exists
-            if (settings.Contains(Key))
+            if (_settings.Contains(Key))
             {
                 // If the value has changed
-                if (settings[Key] != value)
+                if (_settings[Key] != value)
                 {
                     // Store the new value
-                    settings[Key] = value;
+                    _settings[Key] = value;
                     valueChanged = true;
                 }
             }
             // Otherwise create the key.
             else
             {
-                settings.Add(Key, value);
+                _settings.Add(Key, value);
                 valueChanged = true;
             }
             return valueChanged;
         }
 
         /// <summary>
-        /// Save the settings.
+        /// Save the _settings.
         /// </summary>
         private void Save()
         {
@@ -159,7 +181,7 @@ namespace WeatherInformation.ViewModels
                 return;
             }
 
-            settings.Save();
+            _settings.Save();
         }
     }
 }
index 4d7bef3..a4bbe40 100644 (file)
     <Compile Include="Model\ForecastWeatherParser\Temp.cs" />
     <Compile Include="Model\ForecastWeatherParser\Weather.cs" />
     <Compile Include="Model\JsonDataParser\JsonParser.cs" />
+    <Compile Include="Model\Services\CustomHTTPClient.cs" />
     <Compile Include="Model\Services\ServiceParser.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Resources\AppResources.Designer.cs">
     <Reference Include="Newtonsoft.Json">
       <HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
     </Reference>
+    <Reference Include="System.Net.Http">
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\sl4-windowsphone71\System.Net.Http.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Extensions">
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\sl4-windowsphone71\System.Net.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Primitives">
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\sl4-windowsphone71\System.Net.Http.Primitives.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <XliffResource Include="Resources\AppResources.es.xlf">
   </Target>
   -->
   <ProjectExtensions />
+  <Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
+    <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
+    <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
+  </Target>
 </Project>
\ No newline at end of file
index 226e900..deb89d6 100644 (file)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="Microsoft.Bcl" version="1.1.9" targetFramework="wp80" />
+  <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="wp80" />
+  <package id="Microsoft.Net.Http" version="2.2.22" targetFramework="wp80" />
   <package id="Newtonsoft.Json" version="6.0.3" targetFramework="wp80" />
   <package id="WPtoolkit" version="4.2013.08.16" targetFramework="wp80" />
 </packages>
\ No newline at end of file