Skip to main content

DashboardViewer.UpdateExtractDataSourcesAsync(Action<String, ExtractUpdateResult>, Action<String, ExtractUpdateResult>, String[]) Method

Updates the specified extract data sources in the current dashboard asynchronously. Allows you to set custom actions to perform after updating the data and file.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v24.1.Win.dll

NuGet Package: DevExpress.Win.Dashboard

Declaration

public Task UpdateExtractDataSourcesAsync(
    Action<string, ExtractUpdateResult> onDataUpdated,
    Action<string, ExtractUpdateResult> onFileUpdated,
    params string[] dataSourceNames
)

Parameters

Name Type Description
onDataUpdated Action<String, ExtractUpdateResult>

A custom action to perform when the data is updated.

onFileUpdated Action<String, ExtractUpdateResult>

A custom action to perform when the file is updated.

dataSourceNames String[]

A list of the data source names.

Returns

Type Description
Task

The task object that is the asynchronous operation to complete.

Example

View Example: WinForms - Dashboard with Extract Data Source

The following code snippet implements the UpdateExtractAsync method that updates all extract files bound to the dashboard. It displays a message box and reloads DashboardViewer’s data when data is updated, and displays a message box when the extract files are updated.

delegate void SafeUpdate(string file);

private async void UpdateExtractAsync() {
    await dashboardViewer1.UpdateExtractDataSourcesAsync(
        (fileName, result) => { 
            OnDataReady(fileName); 
        },
        (fileName, result) => { 
            MessageBox.Show($"File {fileName} updated "); 
        });
}

void OnDataReady(string fileName) {
    dashboardViewer1.Invoke(new SafeUpdate(UpdateViewer), new object[] { fileName });
}
void UpdateViewer(string fileName) {
    MessageBox.Show($"Data for the file {fileName} is ready ");
    dashboardViewer1.ReloadData();
}
See Also