Ejemplo n.º 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;
            bool     useFadeEffect                = (bool)parameters[0];
            WindowArrangerContainer owner         = (WindowArrangerContainer)parameters[1];
            SplashScreenLock        lockMode      = (SplashScreenLock)parameters[2];
            IList <TimeSpan>        durations     = SplashScreenHelper.FindParameters <TimeSpan>(parameter);
            FlowDirection           flowDirection = SplashScreenHelper.FindParameter <FlowDirection>(parameter);
            Style windowStyle = SplashScreenHelper.FindParameter <Style>(parameter);
            var   window      = new LoadingDecoratorWindowFree(owner, lockMode);

            if (windowStyle != null)
            {
                window.Style = windowStyle;
            }
            else
            {
                window.ApplyDefaultSettings();
            }
            window.SetCurrentValue(FlowDirectionProperty, flowDirection);
            if (useFadeEffect && durations.Any(x => x.TotalMilliseconds > 0))
            {
                Interaction.GetBehaviors(window).Add(new WindowFadeAnimationBehavior()
                {
                    FadeInDuration = durations[0], FadeOutDuration = durations[1]
                });
            }

            return(window);
        }
Ejemplo n.º 3
0
        static Window CreateSplashScreenWindow(object parameter)
        {
            object[] parameters               = (object[])parameter;
            bool     useFadeEffect            = (bool)parameters[0];
            WindowArrangerContainer owner     = (WindowArrangerContainer)parameters[1];
            SplashScreenLock        lockMode  = (SplashScreenLock)parameters[2];
            IList <TimeSpan>        durations = SplashScreenHelper.FindParameters <TimeSpan>(parameter);
            var window = new LoadingDecoratorWindow(owner, lockMode);

            if (useFadeEffect && durations.Any(x => x.TotalMilliseconds > 0))
            {
                Interaction.GetBehaviors(window).Add(new WindowFadeAnimationBehavior()
                {
                    FadeInDuration = durations[0], FadeOutDuration = durations[1]
                });
            }

            return(window);
        }