SplashScreenManager.Default Property
Returns the default SplashScreenManager that allows you to interact with the currently displayed splash forms.
Namespace: DevExpress.XtraSplashScreen
Assembly: DevExpress.XtraEditors.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
SplashScreenManager | A SplashScreenManager that is the default splash screen manager. |
Remarks
The instance returned by the Default property allows you to interact with the currently opened splash form.
Only use the Default property in the following cases:
- to interact with the displayed SplashScreen objects
to interact with WaitForms that have been displayed using the static SplashScreenManager.ShowForm method.
Note
If a Wait Form has been displayed using a non-static method (e.g. SplashScreenManager.ShowWaitForm), the Default property will be set to null during this form’s display.
In all other cases, the Default property returns null. Do not invoke methods on the Default object to open splash forms.
To interact with any splash form, use the SplashScreenManager.SendCommand method. To set a Wait Form’s caption and description, use the SplashScreenManager.SetWaitFormCaption and SplashScreenManager.SetWaitFormDescription methods.
Example
In this example a custom Progress Bar Control is added to a Splash Screen. The example shows how to update this Progress Bar Control dynamically by sending commands from a Splash Screen Manager.Splash Screens are displayed by a Splash Screen Manager in a separate thread. Interaction with Splash Screens can be performed via the command mechanism. You send a command via the SplashScreenManager.SendCommand method and process this command by overriding the SplashScreen.ProcessCommand method. In the example, custom commands are sent to the Splash Screen to advance the progress of the Splash Screen's Progress Bar Control.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-interact-with-a-splash-screen-by-sending-commands-e3576
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraSplashScreen;
namespace SplashScreen_ProcessCommand {
public partial class SplashScreen1 : SplashScreen {
public SplashScreen1() {
InitializeComponent();
}
#region Overrides
public override void ProcessCommand(Enum cmd, object arg) {
base.ProcessCommand(cmd, arg);
SplashScreenCommand command = (SplashScreenCommand)cmd;
if (command == SplashScreenCommand.SetProgress) {
int pos = (int)arg;
progressBarControl1.Position = pos;
}
}
#endregion
public enum SplashScreenCommand {
SetProgress,
Command2,
Command3
}
}
}
Example
A Wait Form is displayed by a Splash Screen Manager in a separate thread. To dynamically change labels within the Wait Form, while it is being displayed, use the SplashScreenManager.SetWaitFormCaption and SetWaitFormDescription methods.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-dynamically-change-a-wait-forms-labels-e3575
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraSplashScreen;
using System.Threading;
namespace WaitForm_SetDescription {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void btnShowWaitForm_Click(object sender, EventArgs e) {
//Open Wait Form
SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
//The Wait Form is opened in a separate thread. To change its Description, use the SetWaitFormDescription method.
for (int i = 1; i <= 100; i++) {
SplashScreenManager.Default.SetWaitFormDescription(i.ToString() + "%");
Thread.Sleep(25);
}
//Close Wait Form
SplashScreenManager.CloseForm(false);
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Default property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.