Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Reactive;
- using Newtonsoft.Json;
- using La_Ruta_Maya.classes;
- using System.Text;
- using System.Device.Location;
- namespace La_Ruta_Maya.pages
- {
- public partial class country : PhoneApplicationPage
- {
- double Latitude;
- double Longitude;
- GeoCoordinateWatcher myCoordinateWatcher;
- public country()
- {
- InitializeComponent();
- }
- private void PhoneApplicationPage_Loaded_1(object sender, RoutedEventArgs e)
- {
- string id = (this.NavigationContext.QueryString["id"]); ;
- WebClient w = new WebClient();
- Observable
- .FromEvent<DownloadStringCompletedEventArgs>(w, "DownloadStringCompleted")
- .Subscribe(r =>
- {
- var deserialized = JsonConvert.DeserializeObject<List<countries>>(r.EventArgs.Result);
- txtMapName.Text = deserialized[0].name.ToString();
- });
- w.DownloadStringAsync(
- new Uri("http://localhost/mayaRouteLocal/countries.php?id=" + id));
- WebClient w2 = new WebClient();
- Observable
- .FromEvent<DownloadStringCompletedEventArgs>(w2, "DownloadStringCompleted")
- .Subscribe(r =>
- {
- var deserialized = JsonConvert.DeserializeObject<List<locationCountry>>(r.EventArgs.Result);
- ruinsList.ItemsSource = deserialized;
- });
- w2.DownloadStringAsync(
- new Uri("http://localhost/mayaRouteLocal/locationCountries.php?id=" + id));
- //Latitude = App.ViewModel.values[int.Parse(id) - 1].latitude;
- //Latitude = App.ViewModel.values[int.Parse(id) - 1].longitude;
- //map1.Center = new GeoCoordinate(Latitude, Longitude);
- //map1.ZoomLevel = 8;
- //map1.ZoomBarVisibility = Visibility.Visible;
- //myCoordinateWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
- //myCoordinateWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(myCoordinateWatcher_PositionChanged);
- }
- void myCoordinateWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
- {
- if (!e.Position.Location.IsUnknown)
- {
- Latitude = e.Position.Location.Latitude;
- Longitude = e.Position.Location.Longitude;
- map1.Center = new GeoCoordinate(Latitude, Longitude);
- }
- }
- private void PhoneList_Tap(object sender, System.Windows.Input.GestureEventArgs e)
- {
- ListBox item = (ListBox)sender;
- if (item.SelectedItem != null)
- {
- // ListBoxItem value = (ListBoxItem)item.SelectedIndex;
- locationCountry lr = item.SelectedItem as locationCountry;
- string url = "/pages/ruinDetail.xaml?id=" + lr.idruin.ToString();
- NavigationService.Navigate(new Uri(url, UriKind.Relative));
- }
- item.SelectedIndex = -1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement