This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xmlns:map=“clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps” | |
| xmlns:location=”clr-namespace:System.Device.Location;assembly=System.Device” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <map:Map x:Name=”Map_Main” d:LayoutOverrides=”Width” Grid.Row=”1” | |
| ZoomLevel=”5” Grid.ColumnSpan=”3” | |
| CredentialsProvider=”AtOVDShdO3A0XtPeKnHLpDHjXsr2vrpLD_hJnxqXMmoT7JfWrmmqtygJEQ9b5Ts3”> | |
| <map:Map.Center> | |
| <location:GeoCoordinate Longitude=”100.547369” Latitude=”13.739239”/> | |
| </map:Map.Center> | |
| <map:Pushpin x:Name=”PushPin_Main”> | |
| <map:Pushpin.Location> | |
| <location:GeoCoordinate Longitude=”100.547369” Latitude=”13.739239”/> | |
| </map:Pushpin.Location> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <phone:PhoneApplicationPage.ApplicationBar> | |
| <shell:ApplicationBar> | |
| <shell:ApplicationBar.MenuItems> | |
| <shell:ApplicationBarMenuItem IsEnabled="True" Text="reset map" Click="ApplicationBarMenu_Reset_Click"/> | |
| </shell:ApplicationBar.MenuItems> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.check.rest.png" IsEnabled="True" Text="find me" Click="ApplicationBarButton_FindMe_Click"/> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.add.rest.png" IsEnabled="True" Text="zoom in" Click="ApplicationBarButton_ZoomIn_Click"/> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.minus.rest.png" IsEnabled="True" Text="zoom out" Click="ApplicationBarButton_ZoomOut_Click"/> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.favs.rest.png" IsEnabled="True" Text="map mode" Click="ApplicationBarButton_MapMode_Click"/> | |
| </shell:ApplicationBar> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private readonly GeoCoordinate defaultLocation = | |
| new GeoCoordinate(13.739239, 100.547369); | |
| private const double defaultZoomLevel = 5; | |
| private GeoCoordinateWatcher watcher; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void FindMe() { | |
| // Reinitialize the GeoCoordinateWatcher | |
| watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); | |
| watcher.MovementThreshold = 100;//distance in metres | |
| // Add event handlers for StatusChanged and PositionChanged events | |
| watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged); | |
| watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged); | |
| // Start data acquisition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { | |
| Deployment.Current.Dispatcher.BeginInvoke(() => LocationChanged(e)); | |
| } | |
| private void LocationChanged(GeoPositionChangedEventArgs<GeoCoordinate> e) { | |
| GeoCoordinate location = e.Position.Location; | |
| Map_Main.SetView(location, 15); | |
| PushPin_Main.Location = location; | |
| PushPin_Main.Visibility = System.Windows.Visibility.Visible; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void Button_Go_Click(object sender, RoutedEventArgs e) | |
| { | |
| if (watcher != null) | |
| { | |
| watcher.Stop(); | |
| } | |
| double lat, lon; | |
| if(!double.TryParse(TextBox_Lat.Text, out lat)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void ApplicationBarMenu_Reset_Click(object sender, System.EventArgs e) | |
| { | |
| ResetMap(); | |
| } | |
| private void ApplicationBarButton_FindMe_Click(object sender, System.EventArgs e) | |
| { | |
| FindMe(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ListBox x:Name="ListBox_Places" ItemTemplate="{StaticResource PlacesItemTemplate}" SelectionChanged="ListBox_Places_SelectionChanged"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <phone:PhoneApplicationPage.ApplicationBar> | |
| <shell:ApplicationBar> | |
| <shell:ApplicationBar.MenuItems> | |
| <shell:ApplicationBarMenuItem IsEnabled="True" Text="change to aerial map" Click="ApplicationBarMenuItem_MapMode_Click"/> | |
| </shell:ApplicationBar.MenuItems> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.feature.search.rest.png" IsEnabled="False" Text="direction" Click="ApplicationBarButton_Direction_Click"/> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.check.rest.png" IsEnabled="True" Text="find me" Click="ApplicationBarButton_FindMe_Click"/> | |
| <shell:ApplicationBarIconButton IconUri="/icons/appbar.cancel.rest.png" IsEnabled="True" Text="clear" Click="ApplicationBarButton_Clear_Click"/> | |
| </shell:ApplicationBar> | |
| </phone:PhoneApplicationPage.ApplicationBar> |