All docs
V19.2
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

How to Create a Slide Show with Asynchronous Maximize and Restore Methods

  • 2 min to read

This example demonstrates how to call the asynchronous maximize and restore methods to create a slide show with the dashboard items.

Note

The complete sample project How to Create a Slide Show with Asynchronous Maximize and Restore Methods is available in the DevExpress Examples repository.

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();
        }
    }
}