简体   繁体   English

在C#中使用Google Maps工作

[英]Using Google Maps for work in C#

I'm trying to use Google maps API from a Desktop app (C#), for doing this we use a resource file that contains an HTML file from which we load the maps-api. 我正在尝试使用来自桌面应用程序(C#)的Google Maps API,为此,我们使用了一个资源文件,其中包含一个HTML文件,可从中加载maps-api。 What we do is load HTML in a WebBrowser Control from windows Forms, from which we use the google earth plugin for 3D visualization and also use the google maps API for geocoding, sometime we also load some KMZ's in that Control. 我们要做的是从Windows窗体中的WebBrowser控件中加载HTML,从中我们将google Earth插件用于3D可视化,还使用google maps API进行地理编码,有时我们还会在该控件中加载一些KMZ。

If we don't use a licensed API the app works, but when we try to use a licensed API, we must register an URL and sign it to be able to use the maps API for work, but it only can be done from a Internet URL. 如果我们不使用许可的API,则该应用程序可以运行,但是当我们尝试使用许可的API时,我们必须注册一个URL并对其进行签名,以能够使用maps API进行工作,但只能通过互联网网址。

Is there another way of using a "work" API for desktop apps? 还有用于桌面应用程序的“工作” API的另一种方法吗?

Kind Regards 亲切的问候

The "authorized URL" you need to register depends a bit on the web browser control you are using. 您需要注册的“授权URL”在某种程度上取决于您使用的Web浏览器控件。 Local files for example usually get a referrer with a file:// URL (eg. file:///C:/somefile.html ) 例如,本地文件通常会获得带有file:// URL的引荐来源网址(例如file:///C:/somefile.html

With an embedded resource, it highly depends on the implementation, but you should be able to use alert(window.location.href) or something similar inside a script block in your embedded HTML to get the proper URL. 对于嵌入式资源,它高度依赖于实现,但是您应该能够在嵌入式HTML的脚本块内使用alert(window.location.href)或类似的东西来获取正确的URL。

Note that the support portal does not allow arbitrary protocols in URLs at the moment, so you might need to contact Google for Work Support if you require special protocols. 请注意,支持门户目前不允许在URL中使用任意协议,因此如果您需要特殊协议,则可能需要与Google for Work支持人员联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM