dashboard-devexpress-dot-dashboardwin-dot-dashboardviewer-dot-maximizedashboarditemasync-x28-system-dot-string-x29.md
Expands the specified dashboard item to the entire dashboard size in an asynchronous task.
Namespace : DevExpress.DashboardWin
Assembly : DevExpress.Dashboard.v25.2.Win.dll
NuGet Package : DevExpress.Win.Dashboard
public Task MaximizeDashboardItemAsync(
string itemName
)
Public Function MaximizeDashboardItemAsync(
itemName As String
) As Task
| Name | Type | Description |
|---|---|---|
| itemName | String |
A String that is the dashboard item component name (the ComponentName property).
|
| Type | Description |
|---|---|
| Task |
The task object that is the asynchronous operation to complete.
|
Use the DashboardViewer.RestoreDashboardItemAsync method to restore the maximized item to its previous size.
This code snippet demonstrates how to call the asynchronous maximize and restore methods to create a slide show with the dashboard items.
using DevExpress.XtraEditors;
using System;
using System.Windows.Forms;
namespace MaximizeSlideShow
{
public partial class ViewerForm1 : XtraForm {
bool isSlideShown = false;
int index = 0;
Timer slideShowTimer = new Timer() {
Interval = 5000
};
public ViewerForm1() {
InitializeComponent();
slideShowTimer.Tick += OnSlideShowTimerTick;
}
async void OnSlideShowTimerTick(object sender, EventArgs e) {
var items = dashboardViewer1.Dashboard.Items;
int maxIndex = items.Count - 1;
if(!isSlideShown) {
slideShowTimer.Stop();
return;
}
await dashboardViewer1.MaximizeDashboardItemAsync(items[index].ComponentName);
if(index == maxIndex)
index = 0;
else
index++;
}
void OnStartClick(object sender, MouseEventArgs e) {
if(!isSlideShown) {
isSlideShown = true;
slideShowTimer.Start();
}
}
async void OnStopClick(object sender, EventArgs e) {
isSlideShown = false;
await dashboardViewer1.RestoreDashboardItemAsync();
}
}
}
Imports DevExpress.XtraEditors
Imports System
Imports System.Windows.Forms
Namespace MaximizeSlideShow
Partial Public Class ViewerForm1
Inherits XtraForm
Private isSlideShown As Boolean = False
Private index As Integer = 0
Private slideShowTimer As New Timer() With {.Interval = 5000}
Public Sub New()
InitializeComponent()
AddHandler slideShowTimer.Tick, AddressOf OnSlideShowTimerTick
End Sub
Private Async Sub OnSlideShowTimerTick(ByVal sender As Object, ByVal e As EventArgs)
Dim items = dashboardViewer1.Dashboard.Items
Dim maxIndex As Integer = items.Count - 1
If Not isSlideShown Then
slideShowTimer.Stop()
Return
End If
Await dashboardViewer1.MaximizeDashboardItemAsync(items(index).ComponentName)
If index = maxIndex Then
index = 0
Else
index += 1
End If
End Sub
Private Sub OnStartClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles simpleButton1.MouseClick
If Not isSlideShown Then
isSlideShown = True
slideShowTimer.Start()
End If
End Sub
Private Async Sub OnStopClick(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton2.Click
isSlideShown = False
Await dashboardViewer1.RestoreDashboardItemAsync()
End Sub
End Class
End Namespace
MaximizeDashboardItemAsync(String)
See Also