LayerBase.DataLoaded Event

Occurs after the data has been loaded into a map layer.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v20.1.dll

Declaration

public event DataLoadedEventHandler DataLoaded
Public Event DataLoaded As DataLoadedEventHandler

Event Data

The DataLoaded event's data class is DataLoadedEventArgs.

Remarks

Handle the DataLoaded event to ensure that the data is loaded completely into a map layer.

Examples

This example shows how to visualize the progress of loading image tiles from the OpenStreetMap data provider using a progress bar.

To accomplish this task, handle the ImageLayer.RequestDataLoading event and specify how the progress bar should be updated using the UpdateProgressBar method. Then, handle the LayerBase.DataLoaded event to specify the final state of the progress bar when the data load is finished.

using DevExpress.XtraMap;
using System;
using System.Windows.Forms;

namespace TilesLoaded {
    public partial class Form1 : Form {
        int requestsCounter = 0;
        ImageLayer Layer { get { return (ImageLayer)mapControl1.Layers[0]; } }

        public Form1() {
            InitializeComponent();
            Layer.RequestDataLoading += Layer_RequestDataLoading;
            Layer.DataLoaded += Layer_DataLoaded;
        }

        void Layer_RequestDataLoading(object sender, EventArgs e) {
            requestsCounter++;
            UpdateProgressBar();
        }

        void Layer_DataLoaded(object sender, DataLoadedEventArgs e) {
            progressBar1.Value = 100;
            progressBar1.Visible = false;
            label1.Visible = false;
            requestsCounter = 0;
        }

        void UpdateProgressBar() {
            if (!progressBar1.Visible)
                progressBar1.Visible = true;
            if (!label1.Visible)
                label1.Visible = true;
            progressBar1.Value = (int)(100 * (requestsCounter - 1) / requestsCounter);
        }
    }
}
See Also