Я разрабатываю приложение, которое использует карту, и использую html, javascript для разработки, я обнаружил, что существует расширение для приложения для хранения Windows для использования бинговой карты, но его не поддерживается в Windows Phone 8.1 разработка javascript. поэтому я взломал приложение для RT и добавил в свой проект, и только ошибка, которую я получаю, это Windows.ApplicationModel.Resource.core.ResourceManager устарел. и я знаю, что другие скрипты загружаются до того, как карта делает. и все же я не мог найти его решение. вот мой код.bing maps in windows phone 8.1
default.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>homePage</title>
<!-- WinJS references -->
<script src="//Microsoft.Phone.WinJS.2.1/js/base.js"></script>
<script src="//Microsoft.Phone.WinJS.2.1/js/ui.js"></script>
<link href="/css/default.css" rel="stylesheet" />
<link href="/pages/home/home.css" rel="stylesheet" />
<script src="/pages/home/home.js"></script>
<!-- bing map api-->
<script type="text/javascript" src="/js/bing/veapicore.js"></script>
<script type="text/javascript" src="/js/bing/veapiModules.js"></script>
<link href="/css/mapcontrol.css" rel="stylesheet" />
<!--<script type="text/javascript"
src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0">
</script>-->
<!-- bing map controls-->
<script src="/js/MapControls.js"></script>
</head>
<body>
<!-- The content that will be loaded and displayed. -->
<div class="fragment homepage">
<header aria-label="Header content" role="banner">
<h1 class="titlearea win-type-ellipsis">
<span class="pagetitle">Native</span>
</h1>
</header>
<section aria-label="Main content" role="main" style="overflow:auto;">
<div style="float:left; margin: 10px 10px 10px 10px;">
<input type="button" value="Get My Location" onclick="GetMyLocation();" />
<input type="text" id="txtStart" placeholder="Source" maxlength="50" />
<input type="text" id="txtEnd" placeholder="Destination" maxlength="50" />
<input type="button" value="Create Route" onclick="GetRoute();" />
</div>
<div id="mapcontainer" style="height:150px;width:150px;"></div>
<div id='itineraryDiv' style="position:relative; width:40%; height:90%; float: right; overflow:auto; font-family:Verdana, Arial"></div>
</section>
</div>
mapcontrol.js
(function() {
function initialize() {
Microsoft.Maps.loadModule('Microsoft.Maps.Map', { callback: GetMap });
}
document.addEventListener("DOMContentLoaded", initialize, false);
})();
var map, searchManager, directionsManager, loc = null;
function GetMap() {
var mapOptions =
{
credentials: "bing map key",
mapTypeId: Microsoft.Maps.MapTypeId.road
};
map = new Microsoft.Maps.Map(document.getElementById("mapcontainer"), mapOptions);
}
function GetMyLocation() {
var geolocator = new Windows.Devices.Geolocation.Geolocator();
geolocator.getGeopositionAsync().then(function (loc) {
var mapCenter = map.getCenter();
mapCenter.latitude = loc.coordinate.latitude;
mapCenter.longitude = loc.coordinate.longitude;
map.setView({ center: mapCenter, zoom: 12 });
var loc = new Microsoft.Maps.Location(loc.coordinate.latitude, loc.coordinate.longitude);
var pushPin = new Microsoft.Maps.Pushpin(loc);
map.entities.push(pushPin);
});
}
function geocodeCallback(response, userData) {
if (response &&
response.results &&
response.results.length > 0) {
var r = response.results[0];
var l = new Microsoft.Maps.Location(r.location.latitude, r.location.longitude);
//Display result on map
var p = new Microsoft.Maps.Pushpin(l);
map.entities.push(p);
//Zoom to result
map.setView({ center: l, zoom: 15 });
} else {
ShowMessage("Geocode Response", "Not results found.");
}
}
function GetRoute() {
ClearMap();
if (directionsManager) {
directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
var startWaypoint = new Microsoft.Maps.Directions.Waypoint(
{ address: document.getElementById('txtStart').value });
var endWaypoint = new Microsoft.Maps.Directions.Waypoint(
{ address: document.getElementById('txtEnd').value });
directionsManager.addWaypoint(startWaypoint);
directionsManager.addWaypoint(endWaypoint);
directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('itineraryDiv') });
directionsManager.calculateDirections();
} else {
Microsoft.Maps.loadModule('Microsoft.Maps.Directions', {
callback: function() {
directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
GetRoute();
}
});
}
}
function ClearMap() {
map.entities.clear();
if (directionsManager) {
directionsManager.resetDirections();
}
}
function geocodeError(request) {
ShowMessage("Geocode Error", "Unable to Geocode request.");
}
function ShowMessage(title, msg) {
var m = new Windows.UI.Popups.MessageDialog(title, msg);
m.showAsync();
}
ошибка, которую я получаю.
Метод Windows.ApplicationModel.Resources.Core.ResourceManager.get_DefaultContext устарел. DefaultContext может быть изменен или недоступен для выпусков после Windows Phone «OSVersion» (TBD). Вместо этого используйте ResourceContext.GetForCurrentView.
будет очень полезно, если кто-то выяснит это. заранее спасибо.
Пробовал, но все же он говорит: «Невозможно загрузить внешний файл в приложение» @rbrundritt –
Взгляните на эти ресурсы: https://blogs.bing.com/ карты/2013/06/28/кросс-платформенный-разработка-с-bing-maps-and-phonegap/и https://code.msdn.microsoft.com/Cross-Platform-Bing-Maps-e96600d5 – rbrundritt
спасибо @ rbrundritt –