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.v20.1.Win.dll
NuGet Packages: DevExpress.Win.Dashboard, DevExpress.WindowsDesktop.Win.Dashboard
Declaration
public void 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. |
Example
Note
Example on GitHub: 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 void UpdateExtractAsync()
{
dashboardViewer1.UpdateExtractDataSourcesAsync((a, b) => { OnDataReady(a); }, (a, __) => { MessageBox.Show($"File {a} 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();
}