public static void Show(Type splashScreenType) { if (typeof(Window).IsAssignableFrom(splashScreenType) && !typeof(ISplashScreen).IsAssignableFrom(splashScreenType)) { throw new InvalidOperationException(DXSplashScreenExceptions.Exception2); } if (typeof(Window).IsAssignableFrom(splashScreenType) && typeof(ISplashScreen).IsAssignableFrom(splashScreenType)) { Func <object, Window> windowCreator = (p) => { Type type = (Type)p; Window splashWindow = (Window)Activator.CreateInstance(type); splashWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; return(splashWindow); }; Func <object, object> splashScreenCreator = null; object windowCreatorParameter = splashScreenType; object splashScreenCreatorParameter = null; Show(windowCreator, splashScreenCreator, windowCreatorParameter, splashScreenCreatorParameter); return; } if (typeof(FrameworkElement).IsAssignableFrom(splashScreenType)) { Func <object, Window> splashScreenWindowCreator = (p) => { Window res = DefaultSplashScreenWindowCreator(null); WindowFadeAnimationBehavior.SetEnableAnimation(res, true); return(res); }; Show(splashScreenWindowCreator, CreateDefaultSplashScreen, new object[] { }, new object[] { splashScreenType }); return; } throw new InvalidOperationException(DXSplashScreenExceptions.Exception2); }
public LoadingDecoratorWindow(bool useFadeEffect, SplashScreenOwner parentContainer, SplashScreenLocation childLocation, bool lockParent) { WindowStyle = WindowStyle.None; AllowsTransparency = true; ShowInTaskbar = false; Background = new SolidColorBrush(Colors.Transparent); SizeToContent = SizeToContent.WidthAndHeight; WindowStartupLocation = WindowStartupLocation.Manual; Left = parentContainer.ControlStartupPosition.Left; Top = parentContainer.ControlStartupPosition.Top; Width = parentContainer.ControlStartupPosition.Width; Height = parentContainer.ControlStartupPosition.Height; Topmost = false; ShowActivated = false; IsHitTestVisible = false; Focusable = false; CreateArranger(parentContainer, childLocation); CreateLocker(parentContainer, lockParent); WindowFadeAnimationBehavior.SetEnableAnimation(this, useFadeEffect); Loaded += OnWindowLoaded; }
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 }); } }
static Window CreateSplashScreenWindow(object parameter) { object[] parameters = (object[])parameter; Style windowStyle = (Style)parameters[0]; WindowStartupLocation startupLocation = (WindowStartupLocation)parameters[1]; Window res; if (windowStyle != null) { res = new Window() { Style = windowStyle, WindowStartupLocation = startupLocation }; } else { res = DXSplashScreen.DefaultSplashScreenWindowCreator(null); res.WindowStartupLocation = startupLocation; WindowFadeAnimationBehavior.SetEnableAnimation(res, true); } return(res); }