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