IOverlayFormService.cs 879 B

12345678910111213141516171819202122232425262728293031323334
  1. using DevExpress.XtraSplashScreen;
  2. using System.Windows.Forms;
  3. public interface IOverlayFormService
  4. {
  5. void ShowOverlayForm();
  6. void CloseOverlayForm();
  7. }
  8. public class OverlayFormService : IOverlayFormService
  9. {
  10. private UserControl owner;
  11. private Form ownerForm;
  12. private IOverlaySplashScreenHandle handle;
  13. public OverlayFormService(UserControl owner)
  14. {
  15. this.owner = owner;
  16. }
  17. public OverlayFormService(Form owner)
  18. {
  19. this.ownerForm = owner;
  20. }
  21. public void CloseOverlayForm()
  22. {
  23. if (handle == null) return;
  24. SplashScreenManager.CloseOverlayForm(handle);
  25. }
  26. public void ShowOverlayForm()
  27. {
  28. if (owner != null)
  29. handle = SplashScreenManager.ShowOverlayForm(owner);
  30. if (ownerForm != null)
  31. handle = SplashScreenManager.ShowOverlayForm(ownerForm);
  32. }
  33. }