public override void DownloadTile( TileId tileId, TileEdgeFlags tileEdgeFlags, object token, RasterTileAvailableDelegate tileAvailableDelegate, int priority) { var uri = tileUriDelegate(tileId); if (uri is object) { if (tileRequests.TryGetValue(tileId, out var tileRequest1)) { throw new InvalidOperationException("Multiple concurrent downloads of the same tile is not supported."); } TileRequest tileRequest2; tileRequests[tileId] = tileRequest2 = new TileRequest() { TileId = tileId, Token = token, TileEdgeFlags = tileEdgeFlags, TileAvailableDelegate = tileAvailableDelegate }; tileRequest2.WebRequest = BitmapImageRequestQueue.Instance.CreateRequest(uri, (NetworkPriority)priority, tileRequest2, new BitmapImageRequestCompletedHandler(TileDownloadCompleted)); } else if (tileSource.SuppliesImagesDirectly) { if (tileRequests.TryGetValue(tileId, out var tileRequest1)) { throw new InvalidOperationException("Multiple concurrent downloads of the same tile is not supported."); } TileRequest tileRequest2; tileRequests[tileId] = tileRequest2 = new TileRequest() { TileId = tileId, Token = token, TileEdgeFlags = tileEdgeFlags, TileAvailableDelegate = tileAvailableDelegate }; tileRequest2.WebRequest = BitmapImageRequestQueue.Instance.CreateRequest(tileImageDelegate, (NetworkPriority)priority, tileRequest2, new BitmapImageRequestCompletedHandler(TileDownloadCompleted)); } else { tileAvailableDelegate(null, new Rect(), null, token); } }
public abstract void DownloadTile( TileId tileId, TileEdgeFlags tileEdgeFlags, object token, RasterTileAvailableDelegate tileAvailableDelegate, int priority);