Ejemplo n.º 1
0
 void ShowUserControlCore(ISplashScreenService service)
 {
     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);
     service.SetSplashScreenProgress(50, 100);
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(50, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual("Loading...", SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     service.SetSplashScreenProgress(100, 200);
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(200, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual("Loading...", SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     service.SetSplashScreenState("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);
     service.HideSplashScreen();
 }
Ejemplo n.º 2
0
        async void ShowSplashScreen(ISplashScreenService splashScreenService, bool infinit = false)
        {
            CurrentSplashScreen = splashScreenService;
            splashScreenService.ShowSplashScreen();
            if (infinit)
            {
                return;
            }
            for (int i = 0; i <= 100; i++)
            {
                switch (i)
                {
                case 0:
                    splashScreenService.SetSplashScreenState("Starting...");
                    break;

                case 50:
                    splashScreenService.SetSplashScreenState("Loading data...");
                    break;

                case 80:
                    splashScreenService.SetSplashScreenState("Finishing...");
                    break;
                }
                splashScreenService.SetSplashScreenProgress(i, 100);
                await Task.Delay(50);
            }
            splashScreenService.HideSplashScreen();
        }
 protected void OnIsBusyChanged()
 {
     _waitIndicatorService.SetSplashScreenState("Doing some work...");
     if (IsBusy)
     {
         _waitIndicatorService.ShowSplashScreen();
     }
     else
     {
         _waitIndicatorService.HideSplashScreen();
     }
 }
Ejemplo n.º 4
0
        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();
        }
 void ShowUserControlCore(ISplashScreenService service) {
     service.ShowSplashScreen();
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(0, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual(null, SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(true, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     service.SetSplashScreenProgress(50, 100);
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(50, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual(null, SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     service.SetSplashScreenProgress(100, 200);
     SplashScreenTestUserControl.DoEvents();
     Assert.AreEqual(100, SplashScreenTestUserControl.ViewModel.Progress);
     Assert.AreEqual(200, SplashScreenTestUserControl.ViewModel.MaxProgress);
     Assert.AreEqual(null, SplashScreenTestUserControl.ViewModel.State);
     Assert.AreEqual(false, SplashScreenTestUserControl.ViewModel.IsIndeterminate);
     service.SetSplashScreenState("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);
     service.HideSplashScreen();
 }
        public static void CloseSplashScreenService(ISplashScreenService service) {
            var dxservice = service as DXSplashScreenService;
            bool useDefaultClose = dxservice == null || dxservice.GetSplashContainer(false).Return(x => !x.IsActive, () => true);
            if(useDefaultClose) {
                CloseDXSplashScreen();
                return;
            }

            var container = dxservice.GetSplashContainer(false);
            service.HideSplashScreen();
            JoinThread(container.OldInfo);
        }