WPF地图应用程序

编程入门 行业动态 更新时间:2024-10-24 08:30:32
本文介绍了WPF地图应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个vb地图应用程序,我需要开发成c#。下面是一段我无法弄清楚的代码。任何人都可以帮忙吗?

Hi, I have a vb maps application that i need to develop into c#. Below is a piece of code that I cannot figure out. Can anyone help?

"> Private geoDoc As XDocument Private Sub ShowGeocodeData() Dim responseStatus = geoDoc...<status>.Single.Value()</status> If (responseStatus = "OK") Then Dim formattedAddress = geoDoc...<formatted_address>(0).Value() Dim latitude = geoDoc...<location>(0).Element("lat").Value() Dim longitude = geoDoc...<location>(0).Element("lng").Value() Dim locationType = geoDoc...<location_type>(0).Value() AddressTxtBlck.Text = formattedAddress LatitudeTxtBlck.Text = latitude LongitudeTxtBlck.Text = longitude Select Case locationType Case "APPROXIMATE" AccuracyTxtBlck.Text = "Approximate" Case "ROOFTOP" AccuracyTxtBlck.Text = "Precise" Case Else AccuracyTxtBlck.Text = "Approximate" End Select lat = Double.Parse(latitude) lng = Double.Parse(longitude) If (SaveButton.IsEnabled = False) Then SaveButton.IsEnabled = True RoadmapToggleButton.IsEnabled = True TerrainToggleButton.IsEnabled = True End If ElseIf (responseStatus = "ZERO_RESULTS") Then MessageBox.Show("Unable to show results for: " & vbCrLf & _ location, "Unknown Location", MessageBoxButton.OK, _ MessageBoxImage.Information) DisplayXXXXXXs() AddressTxtBox.SelectAll() End If ShowMapButton.IsEnabled = True ZoomInButton.IsEnabled = True ZoomOutButton.IsEnabled = True MapProgressBar.Visibility = Windows.Visibility.Hidden End Sub </location_type></location></location>

我无法弄清楚代码粗体文字的含义。即Dim responseStatus = geoDoc ...< status> .Single.Value() 谢谢!

I cannot figure out the meaning of the bold text of code. i.e. Dim responseStatus = geoDoc...<status>.Single.Value() Thanks!

推荐答案

geoDoc。< status> 是一个 IEnumerable< XElement> 单个是一个LINQ扩展方法 Enumerable.Single(Of TSource) [ ^ ] 单个返回IEnumerable中唯一的元素(在这种情况下为 XElement ),但如果IEnumerable包含0或多于1项,则抛出异常。 值是 XElement geoDoc.<status> is an IEnumerable<XElement> Single is a LINQ extension method Enumerable.Single(Of TSource)[^] Single returns the one and only element in the IEnumerable (in this case an XElement), but throws an exception if the IEnumerable contains 0 or more than 1 item. Value is a property of XElement

我正在努力与同一块代码: Hi, I am struggling with the same piece of code: 会员8192163写道: Member 8192163 wrote:

Dim responseStatus = geoDoc ...< status> .Single .Value()

Dim responseStatus = geoDoc...<status>.Single.Value()

你现在找到了答案吗? 谢谢 Bernd 抱歉...我没有看到解决方案。他们在我发布我的问题后出现了。不介意......

Did you find an answer now? Thanks Bernd Sorry... I did not see the solutions. They appeared after I posted my question. Don't mind...

更多推荐

WPF地图应用程序

本文发布于:2023-06-01 10:24:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/412952.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   地图   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!