void SubscribeParentEvents(object parameter) { SplashScreenClosingMode closingMode = SplashScreenHelper.FindParameter <SplashScreenClosingMode>(parameter, SplashScreenClosingMode.OnParentClosed); if (closingMode == SplashScreenClosingMode.Default || closingMode == SplashScreenClosingMode.OnParentClosed) { ActiveInfo.RelationInfo.Do(x => x.ParentClosed += OnSplashScreenOwnerClosed); } }
public static void Show(Type splashScreenType, WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen, SplashScreenOwner owner = null, SplashScreenClosingMode closingMode = SplashScreenClosingMode.Default) { CheckSplashScreenType(splashScreenType); if (typeof(Window).IsAssignableFrom(splashScreenType)) { Func <object, Window> windowCreator = (p) => { Window splashWindow = (Window)Activator.CreateInstance(SplashScreenHelper.FindParameter <Type>(p)); splashWindow.WindowStartupLocation = SplashScreenHelper.FindParameter(p, WindowStartupLocation.CenterScreen); return(splashWindow); }; Show(windowCreator, null, new object[] { splashScreenType, startupLocation, owner, closingMode }, null); } else if (typeof(FrameworkElement).IsAssignableFrom(splashScreenType)) { Func <object, Window> windowCreator = (p) => { Window res = DefaultSplashScreenWindowCreator(p); WindowFadeAnimationBehavior.SetEnableAnimation(res, true); return(res); }; Show(windowCreator, CreateDefaultSplashScreen, new object[] { startupLocation, owner, closingMode }, new object[] { splashScreenType }); } }
public static void Show <T>(WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen, SplashScreenOwner owner = null, SplashScreenClosingMode closingMode = SplashScreenClosingMode.Default) { Show(typeof(T), startupLocation, owner, closingMode); }
public static void Show <T>(Action action, WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen, SplashScreenOwner owner = null, SplashScreenClosingMode closingMode = SplashScreenClosingMode.Default) { Show <T>(startupLocation, owner, closingMode); try { action(); } finally { Close(); } }
public static DXSplashScreenService CreateDefaultSplashScreenAndShow(Window window, FrameworkElement owner = null, SplashScreenOwnerSearchMode ownerSearchMode = SplashScreenOwnerSearchMode.Full , bool activateWindow = true, FrameworkElement windowContent = null, SplashScreenClosingMode? closingMode = null) { DXSplashScreenService service = CreateDefaultService(); service.SplashScreenOwner = owner; if(closingMode.HasValue) service.SplashScreenClosingMode = closingMode.Value; service.OwnerSearchMode = ownerSearchMode; if(windowContent == null) Interaction.GetBehaviors(window).Add(service); else { window.Do(x => x.Content = windowContent); Interaction.GetBehaviors(windowContent).Add(service); } if(window != null) { window.Show(); if(activateWindow && !window.IsActive) window.Activate(); DispatcherHelper.UpdateLayoutAndDoEvents(window); } service.ShowSplashScreen(); SplashScreenTestUserControl.DoEvents(); return service; }
DXSplashScreenService CreateDefaultSplashScreenAndShow(FrameworkElement owner = null, SplashScreenOwnerSearchMode ownerSearchMode = SplashScreenOwnerSearchMode.Full, bool activateWindow = true, FrameworkElement windowContent = null, SplashScreenClosingMode? closingMode = null) { return SplashScreenTestsHelper.CreateDefaultSplashScreenAndShow(RealWindow, owner, ownerSearchMode, activateWindow, windowContent, closingMode); }