Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
GPS, Location API and Calling Web Services - Day 3 - Part 10
Mar 28, 2012 at 5:11 AMI've to say that this comment helped me a lot for adding the Service Reference.
This second post solve the other problem. Hence, for sake of clarity, I am posting here my full code in order to give to everybody the possibility of having a working program.
<Button Content="Find Me" Height="72" HorizontalAlignment="Left" Margin="290,135,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="6,6,0,0" Name="myPositionTextBlock" Text="" VerticalAlignment="Top" Width="444" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="6,42,0,0" Name="myLatitudeTextBlock" Text="" VerticalAlignment="Top" Width="444" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="6,78,0,0" Name="myLongitudeTextBlock" Text="" VerticalAlignment="Top" Width="444" />
GeoCoordinateWatcher myWatcher = new GeoCoordinateWatcher();private void button1_Click(object sender, RoutedEventArgs e) { // Added lines of code myWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(myWatcher_PositionChanged); myWatcher.Start(); myLongitudeTextBlock.Text = myLatitudeTextBlock.Text = myPositionTextBlock.Text = ""; } void myWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { var myPosition = myWatcher.Position; myWatcher.Stop(); double latitude = 0; double longitude = 0; if (!myPosition.Location.IsUnknown) { latitude = myPosition.Location.Latitude; longitude = myPosition.Location.Longitude; } myLatitudeTextBlock.Text = string.Format("Latitude: {0}", latitude); myLongitudeTextBlock.Text = string.Format("Longitude: {0}", longitude); myTerraService.TerraServiceSoapClient client = new myTerraService.TerraServiceSoapClient(); client.ConvertLonLatPtToNearestPlaceCompleted += new EventHandler<myTerraService.ConvertLonLatPtToNearestPlaceCompletedEventArgs>(client_ConvertLonLatPtToNearestPlaceCompleted); client.ConvertLonLatPtToNearestPlaceAsync(new myTerraService.LonLatPt { Lat = latitude, Lon = longitude }); //throw new NotImplementedException(); } void client_ConvertLonLatPtToNearestPlaceCompleted(object sender, myTerraService.ConvertLonLatPtToNearestPlaceCompletedEventArgs e) { myPositionTextBlock.Text = e.Result; //throw new NotImplementedException(); }