@Don -
Based on your suggestions, I’m now using the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.WpfDesktopEdition;
namespace MyProject
{
/// <summary>
/// Interaction logic for MapDisplay.xaml
/// </summary>
public partial class MapWindow : Window
{
public MapWindow()
{
InitializeComponent();
}
private void m_Map_Loaded(object sender, RoutedEventArgs e)
{
m_Map.MapUnit = GeographyUnit.Meter;
m_Map.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));
GoogleMapsOverlay googleOverlay = new GoogleMapsOverlay();
googleOverlay.SendingWebRequest += googleOverlay_SendingWebRequest;
googleOverlay.MapType = GoogleMapsMapType.Terrain;
googleOverlay.IsVisible = true;
m_Map.Overlays.Add(googleOverlay);
m_Map.ZoomLevelSet = new GoogleMapsZoomLevelSet();
m_Map.Refresh();
}
void googleOverlay_SendingWebRequest(object sender, SendingWebRequestEventArgs e)
{
e.WebRequest = WebRequest.Create(e.WebRequest.RequestUri + "&key=mYhIdDeNkEy");
}
}
}
For completeness sake, my .xaml is as follows:
<Window x:Class="MyProject.MapWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:uc1="clr namespace:ThinkGeo.MapSuite.WpfDesktopEdition;assembly=WpfDesktopEdition"
Title="MapWindow" Height="900" Width="900">
<Grid>
<uc1:WpfMap Name="m_Map" Loaded="m_Map_Loaded"/>
</Grid>
</Window>
I’m still running into the same error. I’ve viewed a few of the URLs in my browser, and they appear to resolve fine, but the error is very consistent when running my project. The base code is copied directly from your GPS to Google Map (Desktop) Code Sample. The error seems to occur when zooming in - zooming out hasn’t seen any crashes, although I do get unrendered map pieces quite often, which I wonder if it is a symptom of some underlying problem.
Edit: In addition, I’ve tried the code with all of the different GoogleMapsMapType options (Hybrid, Mobile, Satellite, Terrain, RoadMap), and they all throw the same error.
Thanks,
Ian