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();
        }
 public void ShowUserControlViaSplashScreenType() {
     ISplashScreenService service = new DXSplashScreenService() {
         SplashScreenType = typeof(SplashScreenTestUserControl),
     };
     ShowUserControlCore(service);
 }
 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();
 }
 public void ShowWindowNotISplashScreen2() {
     ISplashScreenService service = new DXSplashScreenService() {
         SplashScreenType = typeof(Window),
     };
     service.ShowSplashScreen();
 }
 public void ShowUserControl() {
     ISplashScreenService service = new DXSplashScreenService() {
         ViewTemplate = new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(SplashScreenTestUserControl)) },
     };
     ShowUserControlCore(service);
 }
 public void UseIndependentWindow_Test07() {
     ISplashScreenService service = new DXSplashScreenService() {
         ViewTemplate = SplashScreenTestsHelper.CreateDefaultTemplate(),
         UseIndependentWindow = true
     };
     service.ShowSplashScreen();
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(0, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual("Loading...", SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(true, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     DXSplashScreen.Progress(50);
     DXSplashScreen.SetState("Test");
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(0, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual("Loading...", SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(true, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     service.SetSplashScreenProgress(50, 100);
     service.SetSplashScreenState("Test");
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(50, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual("Test", SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
 }
        public void ShowWindowISplashScreen() {
            ISplashScreenService service = new DXSplashScreenService() {
                SplashScreenType = typeof(SplashScreenTestWindow),
            };

            service.ShowSplashScreen();
            SplashScreenTestWindow.DoEvents();
            Assert.IsTrue(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(double.NaN, SplashScreenTestWindow.Instance.Progress);
            service.SetSplashScreenProgress(100, 100);
            SplashScreenTestWindow.DoEvents();
            Assert.IsFalse(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(100, SplashScreenTestWindow.Instance.Progress);
            service.SetSplashScreenProgress(100, 200);
            SplashScreenTestWindow.DoEvents();
            Assert.IsFalse(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(100, SplashScreenTestWindow.Instance.Progress);
            DXSplashScreen.CallSplashScreenMethod<SplashScreenTestWindow>(x => x.Text("test"));
            SplashScreenTestWindow.DoEvents();
            Assert.IsFalse(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(100, SplashScreenTestWindow.Instance.Progress);
            Assert.AreEqual("test", ((SplashScreenTestWindow)SplashScreenTestWindow.Instance).TextProp);
            DXSplashScreen.SetState("test");
            service.SetSplashScreenState("test");
            SplashScreenTestWindow.DoEvents();
            service.HideSplashScreen();
        }
 public void ViewTemplateShouldBeSealed() {
     DataTemplate temp = SplashScreenTestsHelper.CreateDefaultTemplate();
     Assert.IsFalse(temp.IsSealed);
     DXSplashScreenService service = new DXSplashScreenService() {
         ViewTemplate = temp,
     };
     Assert.IsTrue(temp.IsSealed);
 }
        public void BindServiceProperties() {
            var service = new DXSplashScreenService() {
                ViewTemplate = new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(SplashScreenTestUserControl)) },
            };
            ISplashScreenService iService = service;
            Border container = new Border();
            ContainerVM vm = ViewModelSource.Create(() => new ContainerVM());
            container.DataContext = vm;
            vm.State = "Loading2";
            BindingOperations.SetBinding(service, DXSplashScreenService.ProgressProperty, new Binding("Progress"));
            BindingOperations.SetBinding(service, DXSplashScreenService.MaxProgressProperty, new Binding("MaxProgress"));
            BindingOperations.SetBinding(service, DXSplashScreenService.StateProperty, new Binding("State"));
            Interaction.GetBehaviors(container).Add(service);

            service.ShowSplashScreen();
            SplashScreenTestUserControl.DoEvents();
            Assert.AreEqual(0, SplashScreenTestUserControl.ViewModel.Progress);
            Assert.AreEqual(0, SplashScreenTestUserControl.ViewModel.MaxProgress);
            Assert.AreEqual("Loading2", SplashScreenTestUserControl.ViewModel.State);
            Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
            vm.Progress = 50; vm.MaxProgress = 100;
            SplashScreenTestUserControl.DoEvents();
            Assert.AreEqual(50, SplashScreenTestUserControl.ViewModel.Progress);
            Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
            Assert.AreEqual("Loading2", SplashScreenTestUserControl.ViewModel.State);
            Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
            vm.Progress = 100; vm.MaxProgress = 200;
            SplashScreenTestUserControl.DoEvents();
            Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.Progress);
            Assert.AreEqual(200, SplashScreenTestUserControl.ViewModel.MaxProgress);
            Assert.AreEqual("Loading2", SplashScreenTestUserControl.ViewModel.State);
            Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
            vm.State = "Test";
            SplashScreenTestUserControl.DoEvents();
            Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.Progress);
            Assert.AreEqual(200, SplashScreenTestUserControl.ViewModel.MaxProgress);
            Assert.AreEqual("Test", SplashScreenTestUserControl.ViewModel.State);
            Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
            iService.HideSplashScreen();
        }
 public void ShowUserControlAndCheckWindowProperties3() {
     Style wndStyle = new Style();
     ISplashScreenService service = new DXSplashScreenService() {
         SplashScreenType = typeof(SplashScreenTestUserControl),
         SplashScreenWindowStyle = wndStyle,
         SplashScreenStartupLocation = WindowStartupLocation.Manual,
     };
     service.ShowSplashScreen();
     SplashScreenTestUserControl.DoEvents();
     CheckWindowStyle(wndStyle, SplashScreenTestUserControl.Window);
     service.HideSplashScreen();
 }
 public void ShowUserControlAndCheckWindowProperties4() {
     Style wndStyle = new Style();
     wndStyle.Setters.Add(new Setter(System.Windows.Window.ShowActivatedProperty, false));
     wndStyle.Setters.Add(new Setter(System.Windows.Window.ShowInTaskbarProperty, true));
     ISplashScreenService service = new DXSplashScreenService() {
         SplashScreenType = typeof(SplashScreenTestWindow),
         SplashScreenWindowStyle = wndStyle,
         SplashScreenStartupLocation = WindowStartupLocation.Manual,
     };
     service.ShowSplashScreen();
     SplashScreenTestWindow.DoEvents();
     CheckWindowStyle(wndStyle, SplashScreenTestWindow.Instance);
     service.HideSplashScreen();
 }
 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();
     CheckWindowStyle(wndStyle, SplashScreenTestUserControl.Window);
     service.HideSplashScreen();
 }
 public void CloseOnAppUnhandledException_Test_T149746() {
     IsolatedDomainTestHelper.RunTest(() => {
         Assert.IsNull(DXSplashScreen.SplashContainer);
         try {
             Application app = new Application();
             app.Startup += (o, e) => {
                 var service = new DXSplashScreenService() {
                     ViewTemplate = new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(SplashScreenTestUserControl)) },
                 };
                 service.ShowSplashScreen();
                 SplashScreenTestUserControl.DoEvents();
                 Assert.IsNotNull(DXSplashScreen.SplashContainer);
                 Assert.IsTrue(DXSplashScreen.IsActive);
                 throw new NotImplementedException();
             };
             app.Run();
         } catch(NotImplementedException) { }
         DispatcherHelper.DoEvents();
         Assert.IsNotNull(DXSplashScreen.SplashContainer);
         Assert.IsFalse(DXSplashScreen.IsActive);
         var thread = DXSplashScreen.SplashContainer.OldInfo.InternalThread;
         if(thread != null)
             thread.Join();
     });
 }
 void AssertIsActive(DXSplashScreenService service, bool checkValue) {
     Assert.AreEqual(checkValue, ((ISplashScreenService)service).IsSplashScreenActive);
 }
 public void ViewTemplateShouldBeSealed() {
     DataTemplate temp = new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(SplashScreenTestUserControl)) };
     Assert.IsFalse(temp.IsSealed);
     DXSplashScreenService service = new DXSplashScreenService() {
         ViewTemplate = temp,
     };
     Assert.IsTrue(temp.IsSealed);
 }
 public void TestB238799() {
     DXSplashScreenService s = new DXSplashScreenService();
     ((ISplashScreenService)s).HideSplashScreen();
     ((ISplashScreenService)s).HideSplashScreen();
 }
 public void ViewTemplateSelectorIsNotSupported() {
     DXSplashScreenService service = new DXSplashScreenService() {
         ViewTemplateSelector = new DataTemplateSelector(),
     };
 }
        public void UseIndependentWindow_Test06() {
            ISplashScreenService service = new DXSplashScreenService() {
                SplashScreenType = typeof(SplashScreenTestWindow),
                UseIndependentWindow = true
            };

            service.ShowSplashScreen();
            SplashScreenTestWindow.DoEvents();
            Assert.IsTrue(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(double.NaN, SplashScreenTestWindow.Instance.Progress);
            service.SetSplashScreenProgress(100, 100);
            SplashScreenTestWindow.DoEvents();
            Assert.IsFalse(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(100, SplashScreenTestWindow.Instance.Progress);
            service.SetSplashScreenProgress(100, 200);
            SplashScreenTestWindow.DoEvents();
            Assert.IsFalse(SplashScreenTestWindow.Instance.IsIndeterminate);
            Assert.AreEqual(100, SplashScreenTestWindow.Instance.Progress);
            AssertHelper.AssertThrows<InvalidOperationException>(() => DXSplashScreen.Progress(10, 20));
            SplashScreenTestWindow.DoEvents();
            Assert.AreEqual(100, SplashScreenTestWindow.Instance.Progress);
            SplashScreenTestsHelper.CloseSplashScreenService(service);
        }