<!--Recursos de la aplicación-->
<Application.Resources>
-<!--
- <SampleData:SettingsPageData x:Key="SettingsPageData" d:IsDataSource="True"/>
- -->
<local:LocalizedStrings xmlns:local="clr-namespace:WeatherInformation" x:Key="LocalizedStrings"/>
</Application.Resources>
<!--Control Pivot-->
<phone:Pivot Title="City, country">
<!--Elemento Pivot uno-->
- <phone:PivotItem Header="forecast">
- <!--Lista de líneas dobles con ajuste de texto-->
+ <phone:PivotItem Header="{Binding LocalizedResources.MainPageForecastHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}">
<phone:LongListSelector Margin="0,0,-12,0" ItemsSource="{Binding ForecastItems}" SelectionChanged="LongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
</phone:PivotItem>
<!--Elemento Pivot dos-->
- <phone:PivotItem Header="current">
- <!--Lista de líneas dobles sin ajuste de texto-->
+ <phone:PivotItem Header="{Binding LocalizedResources.MainPageCurrentHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}">
<phone:LongListSelector Margin="0,0,-12,0" ItemsSource="{Binding ForecastItems}">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
+ <RowDefinition/>
</Grid.RowDefinitions>
<!--TitlePanel contiene el nombre de la aplicación y el título de la página-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
- <TextBlock Text="Pick your location" Style="{StaticResource PhoneTextNormalStyle}"/>
- <TextBlock Text="City, country" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
+ <TextBlock Text="{Binding LocalizedResources.LocationPageTitle, Mode=OneWay, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
+ <TextBlock x:Name="LocationTextCityCountry" Text="{Binding LocalizedResources.LocationPageSubTitle, Mode=OneWay, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle2Style}"/>
</StackPanel>
<!--ContentPanel. Colocar aquí el contenido adicional-->
using System.Windows.Media;
using Microsoft.Phone.Maps.Controls;
using WeatherInformation.Resources;
+using System.Globalization;
+using Microsoft.Phone.Maps.Services;
namespace WeatherInformation
{
);
GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(geoposition.Coordinate);
+ ReverseGeocodeQuery myReverseGeocodeQuery = new ReverseGeocodeQuery();
+ myReverseGeocodeQuery.GeoCoordinate = myGeoCoordinate;
+ myReverseGeocodeQuery.QueryCompleted += QueryCompletedCallback;
+ myReverseGeocodeQuery.QueryAsync();
+
// Create a small circle to mark the current location.
Ellipse myCircle = new Ellipse();
myCircle.Fill = new SolidColorBrush(Colors.Blue);
this.mapWeatherInformation.Layers.Add(myLocationLayer);
_settings["CurrentLatitude"] = myGeoCoordinate.Latitude;
- _settings["CurrentLongitude"] = myGeoCoordinate.Longitude;
+ _settings["CurrentLongitude"] = myGeoCoordinate.Longitude;
}
catch (Exception ex)
{
}
}
+
+ private void QueryCompletedCallback(object sender, QueryCompletedEventArgs<IList<MapLocation>> eventData)
+ {
+ if (eventData.Cancelled)
+ {
+ // Be careful!!! If you throw exception from this point your program will finish with "Unhandled Exception".
+ return;
+ }
+
+ Exception errorException = eventData.Error;
+ if (errorException == null)
+ {
+ if (eventData.Result.Count > 0)
+ {
+ MapAddress address = eventData.Result[0].Information.Address;
+ string cityCountry = String.Format(CultureInfo.InvariantCulture, "{0}, {1}", address.City, address.Country);
+ this.LocationTextCityCountry.Text = cityCountry;
+ }
+ }
+ }
+
+
public static class CoordinateConverter
{
public static GeoCoordinate ConvertGeocoordinate(Geocoordinate geocoordinate)
}
/// <summary>
+ /// Busca una cadena traducida similar a City, country.
+ /// </summary>
+ public static string LocationPageSubTitle {
+ get {
+ return ResourceManager.GetString("LocationPageSubTitle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Busca una cadena traducida similar a Pick your location.
+ /// </summary>
+ public static string LocationPageTitle {
+ get {
+ return ResourceManager.GetString("LocationPageTitle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Busca una cadena traducida similar a current.
+ /// </summary>
+ public static string MainPageCurrentHeader {
+ get {
+ return ResourceManager.GetString("MainPageCurrentHeader", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Busca una cadena traducida similar a forecast.
+ /// </summary>
+ public static string MainPageForecastHeader {
+ get {
+ return ResourceManager.GetString("MainPageForecastHeader", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Busca una cadena traducida similar a Location autodetection seems to be disabled in your phone.
/// </summary>
public static string NoticeErrorLocationAutodetection {
}
/// <summary>
+ /// Busca una cadena traducida similar a settings.
+ /// </summary>
+ public static string SettingsPageHeaderSettings {
+ get {
+ return ResourceManager.GetString("SettingsPageHeaderSettings", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Busca una cadena traducida similar a Temperature units.
/// </summary>
public static string SettingsTemperatureUnitsHeader {
<source>ºF</source>
<target state="new">ºF</target>
</trans-unit>
+ <trans-unit id="Resx/LocationPageSubTitle" translate="yes" xml:space="preserve">
+ <source>City, country</source>
+ <target state="new">City, country</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Subtitle in location page</note>
+ </trans-unit>
+ <trans-unit id="Resx/LocationPageTitle" translate="yes" xml:space="preserve">
+ <source>Pick your location</source>
+ <target state="new">Pick your location</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Title in location page</note>
+ </trans-unit>
+ <trans-unit id="Resx/MainPageForecastHeader" translate="yes" xml:space="preserve">
+ <source>forecast</source>
+ <target state="new">forecast</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Forecast header in main page</note>
+ </trans-unit>
+ <trans-unit id="Resx/SettingsPageHeaderSettings" translate="yes" xml:space="preserve">
+ <source>settings</source>
+ <target state="new">settings</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Header settings in settings page</note>
+ </trans-unit>
+ <trans-unit id="Resx/MainPageCurrentHeader" translate="yes" xml:space="preserve">
+ <source>current</source>
+ <target state="new">current</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Current header in main page</note>
+ </trans-unit>
<trans-unit id="Resx/TemperatureUnitsCentigradeSymbol" translate="yes" xml:space="preserve">
<source>ºC</source>
<target state="new">ºC</target>
<source>ºF</source>
<target state="new">ºF</target>
</trans-unit>
+ <trans-unit id="Resx/LocationPageSubTitle" translate="yes" xml:space="preserve">
+ <source>City, country</source>
+ <target state="new">City, country</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Subtitle in location page</note>
+ </trans-unit>
+ <trans-unit id="Resx/LocationPageTitle" translate="yes" xml:space="preserve">
+ <source>Pick your location</source>
+ <target state="new">Pick your location</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Title in location page</note>
+ </trans-unit>
+ <trans-unit id="Resx/MainPageForecastHeader" translate="yes" xml:space="preserve">
+ <source>forecast</source>
+ <target state="new">forecast</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Forecast header in main page</note>
+ </trans-unit>
+ <trans-unit id="Resx/SettingsPageHeaderSettings" translate="yes" xml:space="preserve">
+ <source>settings</source>
+ <target state="new">settings</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Header settings in settings page</note>
+ </trans-unit>
+ <trans-unit id="Resx/MainPageCurrentHeader" translate="yes" xml:space="preserve">
+ <source>current</source>
+ <target state="new">current</target>
+ <note from="MultilingualBuild" annotates="source" priority="2">Current header in main page</note>
+ </trans-unit>
<trans-unit id="Resx/TemperatureUnitsCentigradeSymbol" translate="yes" xml:space="preserve">
<source>ºC</source>
<target state="new">ºC</target>
<data name="TemperatureUnitsFahrenheitSymbol" xml:space="preserve">
<value>ºF</value>
</data>
+ <data name="LocationPageSubTitle" xml:space="preserve">
+ <value>City, country</value>
+ <comment>Subtitle in location page</comment>
+ </data>
+ <data name="LocationPageTitle" xml:space="preserve">
+ <value>Pick your location</value>
+ <comment>Title in location page</comment>
+ </data>
+ <data name="MainPageCurrentHeader" xml:space="preserve">
+ <value>current</value>
+ <comment>Current header in main page</comment>
+ </data>
+ <data name="MainPageForecastHeader" xml:space="preserve">
+ <value>forecast</value>
+ <comment>Forecast header in main page</comment>
+ </data>
+ <data name="SettingsPageHeaderSettings" xml:space="preserve">
+ <value>settings</value>
+ <comment>Header settings in settings page</comment>
+ </data>
</root>
\ No newline at end of file
<!-- Pivot -->
<phone:Pivot Title="WEATHER INFORMATION">
<!-- Elemento Pivot uno -->
- <phone:PivotItem Header="settings">
- <Grid VerticalAlignment="Top">
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Column="0" Grid.Row="0" Orientation="Vertical" VerticalAlignment="Center">
- <TextBox x:Name="TemperatureUnitsHeader" Text="{Binding LocalizedResources.SettingsTemperatureUnitsHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2"/>
- <toolkit:ListPicker x:Name="TemperatureUnitsSelection" SelectedIndex="{Binding Source={StaticResource SettingsViewModelDataSource}, Path=TemperaruteUnitsSelectionSetting, Mode=TwoWay}" SelectionChanged="TemperatureUnitsSelection_SelectionChanged">
- <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsTemperatureUnitsSelectionFahrenheit, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />
- <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsTemperatureUnitsSelectionCentigrade, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />
- </toolkit:ListPicker>
- </StackPanel>
- <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
- <TextBox x:Name="LanguageHeader" Text="{Binding LocalizedResources.SettingsLanguageHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Background="Transparent" BorderBrush="Transparent" Foreground="#FFA4A2A2" />
- <toolkit:ListPicker x:Name="LanguageSelection" SelectedIndex="{Binding Source={StaticResource SettingsViewModelDataSource}, Path=LanguageSelectionSetting, Mode=TwoWay}" SelectionChanged="LanguageSelection_SelectionChanged">
- <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsLanguageSelectionEnglish, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
- <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 Header="{Binding LocalizedResources.SettingsPageHeaderSettings, Mode=OneWay, Source={StaticResource LocalizedStrings}}">
+ <!--
+ <phone:LongListSelector Margin="0,0,-12,0">
+ <phone:LongListSelector.ItemTemplate>
+ <DataTemplate>
+ -->
+ <Grid VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <StackPanel Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">
+ <TextBlock x:Name="TemperatureUnitsHeader" Text="{Binding LocalizedResources.SettingsTemperatureUnitsHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Foreground="#FFA4A2A2" Style="{StaticResource PhoneTextTitle2Style}"/>
+ <toolkit:ListPicker x:Name="TemperatureUnitsSelection" SelectedIndex="{Binding Source={StaticResource SettingsViewModelDataSource}, Path=TemperaruteUnitsSelectionSetting, Mode=TwoWay}" SelectionChanged="TemperatureUnitsSelection_SelectionChanged">
+ <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsTemperatureUnitsSelectionFahrenheit, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />
+ <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsTemperatureUnitsSelectionCentigrade, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />
+ </toolkit:ListPicker>
+ </StackPanel>
+ <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center">
+ <TextBlock x:Name="LanguageHeader" Text="{Binding LocalizedResources.SettingsLanguageHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Foreground="#FFA4A2A2" Style="{StaticResource PhoneTextTitle2Style}"/>
+ <toolkit:ListPicker x:Name="LanguageSelection" SelectedIndex="{Binding Source={StaticResource SettingsViewModelDataSource}, Path=LanguageSelectionSetting, Mode=TwoWay}" SelectionChanged="LanguageSelection_SelectionChanged">
+ <toolkit:ListPickerItem Content="{Binding LocalizedResources.SettingsLanguageSelectionEnglish, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
+ <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">
+ <TextBlock x:Name="ForecastDayNumbersHeader" Text="{Binding LocalizedResources.SettingsForecastDayNumbersHeader, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Foreground="#FFA4A2A2" Style="{StaticResource PhoneTextTitle2Style}"/>
+ <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>
+ <!--
+ </DataTemplate>
+ </phone:LongListSelector.ItemTemplate>
+ </phone:LongListSelector>
+ -->
</phone:PivotItem>
- <!-- Elemento Pivot dos -->
+ <!--Elemento Pivot dos-->
<phone:PivotItem Header="notifications">
- <Grid/>
+ <phone:LongListSelector Margin="0,0,-12,0">
+ <phone:LongListSelector.ItemTemplate>
+ <DataTemplate>
+ </DataTemplate>
+ </phone:LongListSelector.ItemTemplate>
+ </phone:LongListSelector>
</phone:PivotItem>
</phone:Pivot>
- <phone:LongListSelector HorizontalAlignment="Left" Height="100" Margin="825,108,-445,0" VerticalAlignment="Top" Width="100"/>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file