I'm working on adding some developer tools for our new enterprise application. To that end, I'd liek to be able to add an optional Cancel button. I'd modify my ShowSplashScreen to take in a CancellationTokenSource.
I'd liek the cancel click to trigger that cancellation. What is the best approach to accomplish such a goal? A lot of the devex samples I've looked at seem rather out of date with the Splash Screens you are showing today.
As of now, I'm just using the WaitIndicator class. I understand I'll probably need to be able to roll my own XAML splash, and that's fine.
C#/// <summary>
/// Show a small splash screen
/// </summary>
/// <param name="owner">The parent UI element</param>
/// <param name="text">the text to show on the splash screen</param>
public static void ShowSplashScreen(DependencyObject owner, string text)
{
var activeSplashScreen = DevExpress.Xpf.Core.SplashScreenManager.ActiveSplashScreens
.FirstOrDefault();
if (activeSplashScreen == null)
{
var splash = DevExpress.Xpf.Core.SplashScreenManager.CreateWaitIndicator(
new DevExpress.Mvvm.DXSplashScreenViewModel
{
IsIndeterminate = true,
Title = string.Empty,
Subtitle = string.Empty,
Copyright = default,
Status = text,
Logo = default
}, topmost: false);
splash.Show(
showDelay: 250,
minDuration: 1000,
owner,
WindowStartupLocation.CenterOwner,
trackOwnerPosition: true,
DevExpress.Xpf.Core.InputBlockMode.None);
}
else
{
activeSplashScreen.ViewModel.Status = text;
}
}