country = PhoneApplicationService.Current.State["Country"] as string;
}
- if (!string.IsNullOrEmpty(JSONRemoteCurrentWeather) && !string.IsNullOrEmpty(JSONRemoteForecastWeather))
+ if (!string.IsNullOrEmpty(JSONRemoteCurrentWeather) && !string.IsNullOrEmpty(JSONRemoteForecastWeather) &&
+ !string.IsNullOrEmpty(city) && !string.IsNullOrEmpty(country))
{
- // TODO: I am repeating this code 2 times. What could I do to improve it?
var parser = new ServiceParser(new JsonParser());
weatherData = parser.WeatherDataParser(JSONRemoteForecastWeather, JSONRemoteCurrentWeather);
- weatherData.City = city ?? "";
- weatherData.Country = country ?? "";
+ weatherData.City = city;
+ weatherData.Country = country;
}
ApplicationDataObject = weatherData;
{
if (eventData.Result.Count > 0)
{
- // TODO: What if there is no city or country. Is there null value or empty string?
MapAddress address = eventData.Result[0].Information.Address;
GeoCoordinate currentGeoCoordinate = eventData.Result[0].GeoCoordinate;
this.mapWeatherInformation.Center = geoCoordinate;
this.mapWeatherInformation.ZoomLevel = 13;
- // TODO: What if there is no city or country. Is there null value or empty string?
- string cityCountry = String.Format(CultureInfo.InvariantCulture, "{0}, {1}", city, country);
- this.LocationTextCityCountry.Text = cityCountry;
+ if (string.IsNullOrEmpty(city))
+ {
+ city = AppResources.DefaultCity;
+ }
+ if (string.IsNullOrEmpty(country))
+ {
+ country = AppResources.DefaultCountry;
+ }
+ this.LocationTextCityCountry.Text = String.Format(CultureInfo.InvariantCulture, "{0}, {1}", city, country);
_city = city;
_country = country;
// Add the MapLayer to the Map.
}
/// <summary>
+ /// Busca una cadena traducida similar a City not found.
+ /// </summary>
+ public static string DefaultCity {
+ get {
+ return ResourceManager.GetString("DefaultCity", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Busca una cadena traducida similar a Country not found.
+ /// </summary>
+ public static string DefaultCountry {
+ get {
+ return ResourceManager.GetString("DefaultCountry", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Busca una cadena traducida similar a City, country.
/// </summary>
public static string LocationPageSubTitle {
<value>Detección automática de la ubicación parece estar desactivada en el teléfono o el servicio no está disponible.</value>
<comment>Message box error: while trying to get automatic current location</comment>
</data>
+ <data name="DefaultCountry" xml:space="preserve">
+ <value>País no encontrado</value>
+ <comment>Country, default value.</comment>
+ </data>
+ <data name="DefaultCity" xml:space="preserve">
+ <value>Ciudad no encontrada</value>
+ <comment>City, default value.</comment>
+ </data>
</root>
\ No newline at end of file
<target state="translated">Posición actual</target>
<note from="MultilingualBuild" annotates="source" priority="2">Map page, button get the user's current location</note>
</trans-unit>
+ <trans-unit id="Resx/DefaultCountry" translate="yes" xml:space="preserve">
+ <source>Country not found</source>
+ <target state="translated">País no encontrado</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Country, default value.</note>
+ </trans-unit>
+ <trans-unit id="Resx/DefaultCity" translate="yes" xml:space="preserve">
+ <source>City not found</source>
+ <target state="translated">Ciudad no encontrada</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">City, default value.</note>
+ </trans-unit>
<trans-unit id="Resx/SelectedDatePageMorning" translate="yes" xml:space="preserve">
<source>MORNING</source>
<target state="translated">MAÑANA</target>
<target state="new">Current Location</target>
<note from="MultilingualBuild" annotates="source" priority="2">Map page, button get the user's current location</note>
</trans-unit>
+ <trans-unit id="Resx/DefaultCountry" translate="yes" xml:space="preserve">
+ <source>Country not found</source>
+ <target state="new">Country not found</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Country, default value.</note>
+ </trans-unit>
+ <trans-unit id="Resx/DefaultCity" translate="yes" xml:space="preserve">
+ <source>City not found</source>
+ <target state="new">City not found</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">City, default value.</note>
+ </trans-unit>
<trans-unit id="Resx/SelectedDatePageMorning" translate="yes" xml:space="preserve">
<source>MORNING</source>
<target state="new">MORNING</target>
<value>Current Location</value>
<comment>Map page, button get the user's current location</comment>
</data>
+ <data name="DefaultCity" xml:space="preserve">
+ <value>City not found</value>
+ <comment>City, default value.</comment>
+ </data>
+ <data name="DefaultCountry" xml:space="preserve">
+ <value>Country not found</value>
+ <comment>Country, default value.</comment>
+ </data>
</root>
\ No newline at end of file
NotifyPropertyChanged("CurrentSunSet");
NotifyPropertyChanged("CurrentSunSetText");
- // TODO: What if address is not available? I should show something like "Address not found" by default...
string country = weatherData.Country;
string city = weatherData.City;
string cityCountry = String.Format(CultureInfo.InvariantCulture, "{0}, {1}", city, country);
this.SelectedDateNightTempUnits = selectedDateTempUnits;
NotifyPropertyChanged("SelectedDateNightTempUnits");
- // TODO: What if address is not available? I should show something like "Address not found" by default...
string country = weatherData.Country;
string city = weatherData.City;
string cityCountry = String.Format(CultureInfo.InvariantCulture, "{0}, {1}", city, country);