Example #1
0
        static Window CreateSplashScreenWindow(object parameter)
        {
            Type             windowType    = SplashScreenHelper.FindParameter <Type>(parameter);
            Style            windowStyle   = SplashScreenHelper.FindParameter <Style>(parameter);
            IList <TimeSpan> fadeDurations = SplashScreenHelper.FindParameters <TimeSpan>(parameter);
            Window           res;

            if (windowType != null)
            {
                res = (Window)Activator.CreateInstance(windowType);
            }
            else if (windowStyle != null)
            {
                res = new DXSplashScreen.SplashScreenWindow();
            }
            else
            {
                res = DXSplashScreen.DefaultSplashScreenWindowCreator(parameter);
            }

            res.WindowStartupLocation = SplashScreenHelper.FindParameter <WindowStartupLocation>(parameter, WindowStartupLocation.CenterScreen);
            if (windowStyle != null)
            {
                res.Style = windowStyle;
            }
            if (fadeDurations.Any(x => x.TotalMilliseconds > 0) && !Interaction.GetBehaviors(res).Any(x => x is WindowFadeAnimationBehavior))
            {
                Interaction.GetBehaviors(res).Add(new WindowFadeAnimationBehavior()
                {
                    FadeInDuration = fadeDurations[0], FadeOutDuration = fadeDurations[1]
                });
            }

            return(res);
        }
        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);
        }