Пример #1
0
        public void ShowUserControlAndCheckWindowProperties()
        {
            ISplashScreenService service = new DXSplashScreenService()
            {
                ViewTemplate = new DataTemplate()
                {
                    VisualTree = new FrameworkElementFactory(typeof(SplashScreenTestUserControl))
                },
            };

            service.ShowSplashScreen();
            SplashScreenTestUserControl.DoEvents();
            Window         wnd       = SplashScreenTestUserControl.Window;
            AutoResetEvent SyncEvent = new AutoResetEvent(false);
            bool           hasError  = true;

            wnd.Dispatcher.BeginInvoke(new Action(() => {
                hasError = false;
                hasError = hasError | !(WindowStartupLocation.CenterScreen == wnd.WindowStartupLocation);
                hasError = hasError | !(true == WindowFadeAnimationBehavior.GetEnableAnimation(wnd));
                hasError = hasError | !(null == wnd.Style);
                hasError = hasError | !(WindowStyle.None == wnd.WindowStyle);
                hasError = hasError | !(ResizeMode.NoResize == wnd.ResizeMode);
                hasError = hasError | !(true == wnd.AllowsTransparency);
                hasError = hasError | !(Colors.Transparent == ((SolidColorBrush)wnd.Background).Color);
                hasError = hasError | !(false == wnd.ShowInTaskbar);
                hasError = hasError | !(true == wnd.Topmost);
                hasError = hasError | !(SizeToContent.WidthAndHeight == wnd.SizeToContent);
                SyncEvent.Set();
            }));
            SyncEvent.WaitOne(TimeSpan.FromSeconds(2));
            Assert.IsFalse(hasError);
            service.HideSplashScreen();
        }
Пример #2
0
        public void ShowUserControlAndCheckWindowProperties2()
        {
            Style wndStyle = new Style();
            ISplashScreenService service = new DXSplashScreenService()
            {
                ViewTemplate = new DataTemplate()
                {
                    VisualTree = new FrameworkElementFactory(typeof(SplashScreenTestUserControl))
                },
                SplashScreenWindowStyle     = wndStyle,
                SplashScreenStartupLocation = WindowStartupLocation.Manual,
            };

            service.ShowSplashScreen();
            SplashScreenTestUserControl.DoEvents();
            Window         wnd       = SplashScreenTestUserControl.Window;
            AutoResetEvent SyncEvent = new AutoResetEvent(false);
            bool           hasError  = true;

            wnd.Dispatcher.BeginInvoke(new Action(() => {
                hasError = false;
                hasError = hasError | !(WindowStartupLocation.Manual == wnd.WindowStartupLocation);
                hasError = hasError | !(false == WindowFadeAnimationBehavior.GetEnableAnimation(wnd));
                hasError = hasError | !(wndStyle == wnd.Style);
                hasError = hasError | !(WindowStyle.SingleBorderWindow == wnd.WindowStyle);
                hasError = hasError | !(ResizeMode.CanResize == wnd.ResizeMode);
                hasError = hasError | !(false == wnd.AllowsTransparency);
                hasError = hasError | !(true == wnd.ShowInTaskbar);
                hasError = hasError | !(false == wnd.Topmost);
                hasError = hasError | !(SizeToContent.Manual == wnd.SizeToContent);
                SyncEvent.Set();
            }));
            SyncEvent.WaitOne(TimeSpan.FromSeconds(2));
            Assert.IsFalse(hasError);
            service.HideSplashScreen();
        }