using DevExpress.XtraSplashScreen; using System.Windows.Forms; public interface IOverlayFormService { void ShowOverlayForm(); void CloseOverlayForm(); } public class OverlayFormService : IOverlayFormService { private UserControl owner; private Form ownerForm; private IOverlaySplashScreenHandle handle; public OverlayFormService(UserControl owner) { this.owner = owner; } public OverlayFormService(Form owner) { this.ownerForm = owner; } public void CloseOverlayForm() { if (handle == null) return; SplashScreenManager.CloseOverlayForm(handle); } public void ShowOverlayForm() { if (owner != null) handle = SplashScreenManager.ShowOverlayForm(owner); if (ownerForm != null) handle = SplashScreenManager.ShowOverlayForm(ownerForm); } }