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
| { | |
| "response": { | |
| "version": "0.1" | |
| ,"termsofService": "http://www.wunderground.com/weather/api/d/terms.html" | |
| ,"features": { | |
| "geolookup": 1 | |
| } | |
| , "results": [ | |
| { | |
| "name": "Aranyaprathet", |
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
| /* | |
| Pretty Date script modified from John Resig here http://ejohn.org/blog/javascript-pretty-date | |
| */ | |
| function relativeDateTime (tdate) { | |
| var system_date; | |
| if (typeof (tdate) === "number") { | |
| tdate = new Date(tdate).toString(); | |
| } | |
| if (navigator.userAgent.match(/MSIE\s([^;]*)/)) { |
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 ListBox_Places_SelectionChanged(object sender, SelectionChangedEventArgs e) | |
| { | |
| ListBox listbox = sender as ListBox; | |
| if(listbox.SelectedIndex < 0) return; | |
| // ดึงค่า item ที่ถูกเลือก มาจาก listbox | |
| Place item = listbox.SelectedItem as Place; | |
| // เลื่อน pivot ให้กลับไปยังหน้า map | |
| PivotRoot.SelectedIndex = 0; |
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 ApplicationBarButton_FindMe_Click(object sender, System.EventArgs e) | |
| { | |
| PivotRoot.SelectedIndex = 0; | |
| FindMe(); | |
| } | |
| private void ApplicationBarButton_Direction_Click(object sender, EventArgs e) | |
| { | |
| BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask(); |
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; | |
| PushPin_Me.Location = 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
| private void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) | |
| { | |
| Deployment.Current.Dispatcher.BeginInvoke(() => LocationStatusChanged(e)); | |
| } | |
| private void LocationStatusChanged(GeoPositionStatusChangedEventArgs e) | |
| { | |
| ApplicationBarIconButton ApplicationBarButton_FindMe = | |
| ApplicationBar.Buttons[1] as ApplicationBarIconButton; | |
| switch (e.Status) |
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 ClearMap() | |
| { | |
| Map_Main.SetView(defaultLocation, defaultZoomLevel); | |
| Map_Main.Mode = new RoadMode(); | |
| PushPin_Me.Location = defaultLocation; | |
| PushPin_Me.Visibility = System.Windows.Visibility.Collapsed; | |
| PushPin_Dest.Visibility = System.Windows.Visibility.Collapsed; | |
| } |
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); |