windowsforms-devexpress-dot-xtramap-dot-imagelayer-4362392e.md
Occurs when a request data download has begun.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
public event EventHandler RequestDataLoading
Public Event RequestDataLoading As EventHandler
The RequestDataLoading event's data class is EventArgs.
This example demonstrates how to monitor the service request state.
To do this, handle the ImageLayer.RequestDataLoading event. Specify the wait form which will be shown when data is loading. Handle the LayerBase.DataLoaded event to determine the state of the wait form after the map data is obtained.
using DevExpress.XtraMap;
using System;
using System.Windows.Forms;
namespace RequestDataLoadingExample {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
ImageLayer layer = new ImageLayer();
mapControl1.Layers.Add(layer);
BingMapDataProvider provider = new BingMapDataProvider();
provider.BingKey = "YOUR_BING_KEY";
layer.DataProvider = provider;
layer.RequestDataLoading += OnRequestDataLoading;
layer.DataLoaded += OnDataLoaded;
}
void OnRequestDataLoading(object sender, EventArgs e) {
Cursor.Current = Cursors.WaitCursor;
if (!splashScreenManager1.IsSplashFormVisible)
splashScreenManager1.ShowWaitForm();
}
void OnDataLoaded(object sender, DataLoadedEventArgs e) {
Cursor.Current = Cursors.Default;
splashScreenManager1.CloseWaitForm();
}
}
}
Imports DevExpress.XtraMap
Imports System
Imports System.Windows.Forms
Namespace RequestDataLoadingExample
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim layer As New ImageLayer()
mapControl1.Layers.Add(layer)
Dim provider As New BingMapDataProvider()
provider.BingKey = "YOUR_BING_KEY"
layer.DataProvider = provider
AddHandler layer.RequestDataLoading, AddressOf OnRequestDataLoading
AddHandler layer.DataLoaded, AddressOf OnDataLoaded
End Sub
Private Sub OnRequestDataLoading(ByVal sender As Object, ByVal e As EventArgs)
Cursor.Current = Cursors.WaitCursor
If Not splashScreenManager1.IsSplashFormVisible Then
splashScreenManager1.ShowWaitForm()
End If
End Sub
Private Sub OnDataLoaded(ByVal sender As Object, ByVal e As DataLoadedEventArgs)
Cursor.Current = Cursors.Default
splashScreenManager1.CloseWaitForm()
End Sub
End Class
End Namespace
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RequestDataLoading event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-map-show-the-progress-of-loading-image-tiles/CS/TilesLoaded/Form1.cs#L12
InitializeComponent();
Layer.RequestDataLoading += Layer_RequestDataLoading;
Layer.DataLoaded += Layer_DataLoaded;
winforms-map-show-the-progress-of-loading-image-tiles/VB/TilesLoaded/Form1.vb#L20
InitializeComponent()
AddHandler Layer.RequestDataLoading, AddressOf Layer_RequestDataLoading
AddHandler Layer.DataLoaded, AddressOf Layer_DataLoaded
See Also