我有以下代码:
public partial class Main : Form
{
private delegate void LoadMapPointRegion();
private LoadMapPointRegion lmprd;
private MapPoint.Application mpApp;
private MapPoint.Map mpMap;
public Main()
{
InitializeComponent();
lmprd = new LoadMapPointRegion(mpControl_LoadRegion);
lmprd.BeginInvoke(new AsyncCallback(mpControl_RegionLoaded), null);
}
private void mpControl_LoadRegion()
{
mpControl.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica);
mpMap = mpControl.ActiveMap;
mpApp = mpMap.Application;
}
private void mpControl_RegionLoaded(IAsyncResult iar)
{
MessageBox.Show("MapPoint loaded async: " + iar.CompletedSynchronously.ToString());
}
}
这应该在mpControl_LoadRegion
运行时加载表单并启用与它的交互。
加载地图点区域需要5到10秒,这就是我异步进行的原因。
但iar.CompletedSynchronously
始终为假。
我错过了什么?