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(); }
static void VerifyService(ISplashScreenService service) { if (service == null) { throw new ArgumentNullException("service"); } }
public async Task NFCeShouldBeSentTest() { //Arrange Mock <ISplashScreenService> splashMock = new Mock <ISplashScreenService>(); Mock <IDialogService> dialogMock = new Mock <IDialogService>(); Mock <IClosable> closableMock = new Mock <IClosable>(); Mock <INotaFiscalService> notaFiscalServiceMock = new Mock <INotaFiscalService>(); notaFiscalServiceMock.Setup(m => m.EnviarNotaFiscalAsync(It.IsAny <NotaFiscal>(), It.IsAny <string>(), It.IsAny <string>())).ReturnsAsync(0); _splashScreenService = splashMock.Object; _dialogService = dialogMock.Object; _notaFiscalService = notaFiscalServiceMock.Object; _enviarNotaController = new EnviarNotaController(_splashScreenService, _dialogService, _notaFiscalService); var viewModel = new NFCeViewModel(new DestinatarioViewModel(), _splashScreenService, _dialogService, _enviarNotaController); viewModel.LoadedCmd.Execute(null); viewModel.Produto.QtdeProduto = 1; viewModel.Produto.ProdutoSelecionado = viewModel.ProdutosCombo[0]; viewModel.AdicionarProdutoCmd.Execute(null); viewModel.GerarPagtoCmd.Execute(null); //Act await viewModel.EnviarNotaCmd.ExecuteAsync(closableMock.Object); //Assert notaFiscalServiceMock.Verify(n => n.EnviarNotaFiscalAsync(It.IsAny <NotaFiscal>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); closableMock.Verify(c => c.Close(), Times.Once); }
/// <summary> /// Initializes a new instance of the <see cref="ShellService" /> class. /// </summary> /// <param name="typeFactory">The type factory.</param> /// <param name="keyboardMappingsService">The keyboard mappings service.</param> /// <param name="commandManager">The command manager.</param> /// <param name="splashScreenService">The splash screen service.</param> /// <param name="ensureStartupService">The ensure startup service.</param> /// <param name="applicationInitializationService">The application initialization service.</param> /// <param name="dependencyResolver">The dependency resolver.</param> /// <param name="serviceLocator">The service locator.</param> /// <exception cref="ArgumentNullException">The <paramref name="typeFactory" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="keyboardMappingsService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="commandManager" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="splashScreenService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="applicationInitializationService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="dependencyResolver" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="serviceLocator" /> is <c>null</c>.</exception> public ShellService(ITypeFactory typeFactory, IKeyboardMappingsService keyboardMappingsService, ICommandManager commandManager, ISplashScreenService splashScreenService, IEnsureStartupService ensureStartupService, IApplicationInitializationService applicationInitializationService, IDependencyResolver dependencyResolver, IServiceLocator serviceLocator) { Argument.IsNotNull(() => typeFactory); Argument.IsNotNull(() => keyboardMappingsService); Argument.IsNotNull(() => commandManager); Argument.IsNotNull(() => splashScreenService); Argument.IsNotNull(() => ensureStartupService); Argument.IsNotNull(() => applicationInitializationService); Argument.IsNotNull(() => dependencyResolver); Argument.IsNotNull(() => serviceLocator); _typeFactory = typeFactory; _keyboardMappingsService = keyboardMappingsService; _commandManager = commandManager; _splashScreenService = splashScreenService; _ensureStartupService = ensureStartupService; _applicationInitializationService = applicationInitializationService; _dependencyResolver = dependencyResolver; _serviceLocator = serviceLocator; var entryAssembly = Catel.Reflection.AssemblyHelper.GetEntryAssembly(); Log.Info("Starting {0} v{1} ({2})", entryAssembly.Title(), entryAssembly.Version(), entryAssembly.InformationalVersion()); // Initialize (now we have an application) DotNetPatchHelper.Initialize(); }
/// <summary> /// The register task. /// </summary> /// <param name="splashScreenService"> /// The splash screen service. /// </param> private static void RegisterTask(ISplashScreenService splashScreenService) { splashScreenService.Enqueue(new ActionTask("Linking to Satelite", delegate { Thread.Sleep(1000); })); splashScreenService.Enqueue(new ActionTask("Downloading original files from NASA servers", delegate { Thread.Sleep(1000); })); splashScreenService.Enqueue(new ActionTask("Replacing original files with fake ones", delegate { Thread.Sleep(1000); })); splashScreenService.Enqueue(new ActionTask("Closing satellite connections", delegate { Thread.Sleep(1000); })); }
/// <summary> /// The register detailed task. /// </summary> /// <param name="splashScreenService"> /// The splash screen service. /// </param> private static void RegisterDetailedTask(ISplashScreenService splashScreenService) { splashScreenService.Enqueue(new ActionTask("Setting up enviroment", tracker => { tracker.UpdateStatus("Loading dictionaries..."); Thread.Sleep(3000); tracker.UpdateStatus("Locating fake files..."); Thread.Sleep(3000); tracker.UpdateStatus("Almost ready, wait for it....", 98); Thread.Sleep(3000); tracker.UpdateStatus("Sorry, you have to wait more....", true); Thread.Sleep(3000); })); splashScreenService.Enqueue(new ActionTask("Linking to Satelite", tracker => { tracker.UpdateStatus("Step 1", 25); Thread.Sleep(1000); tracker.UpdateStatus("Step 2", 50); Thread.Sleep(1000); tracker.UpdateStatus("Step 3", 75); Thread.Sleep(1000); tracker.UpdateStatus("Step 4", 100); })); splashScreenService.Enqueue(new ActionTask("Downloading original files from NASA servers", tracker => { tracker.UpdateStatus("Step 1", 25); Thread.Sleep(1000); tracker.UpdateStatus("Step 2", 50); Thread.Sleep(1000); tracker.UpdateStatus("Step 3", 75); Thread.Sleep(1000); tracker.UpdateStatus("Step 4", 100); })); splashScreenService.Enqueue(new ActionTask("Replacing original files with fake ones", tracker => { tracker.UpdateStatus("Step 1", 25); Thread.Sleep(1000); tracker.UpdateStatus("Step 2", 50); Thread.Sleep(1000); tracker.UpdateStatus("Step 3", 75); Thread.Sleep(1000); tracker.UpdateStatus("Step 4", 100); })); splashScreenService.Enqueue(new ActionTask("Closing satellite connections", tracker => { tracker.UpdateStatus("Step 1", 25); Thread.Sleep(1000); tracker.UpdateStatus("Step 2", 50); Thread.Sleep(1000); tracker.UpdateStatus("Step 3", 75); Thread.Sleep(1000); tracker.UpdateStatus("Step 4", 100); })); }
/// <summary> /// The commit asyc. /// </summary> /// <typeparam name="TViewModel">The view model type.</typeparam> /// <param name="this">The splash screen service.</param> /// <param name="viewModel">The view model.</param> /// <param name="regionName">The region name.</param> /// <param name="completedCallback">The completed callback.</param> public static void CommitAsync <TViewModel>(this ISplashScreenService @this, TViewModel viewModel, string regionName, Action completedCallback = null) where TViewModel : IProgressNotifyableViewModel { var dependencyResolver = IoCConfiguration.DefaultDependencyResolver; var uiCompositionService = dependencyResolver.Resolve <IUICompositionService>(); uiCompositionService.Activate(viewModel, regionName); @this.CommitAsync(viewModel: viewModel, show: false, completedCallback: completedCallback); }
/// <summary> /// Initializes a new instance of the <see cref="SplashScreen" /> class. /// </summary> public SplashScreen(ISplashScreenService splashScreenService) : base(DataWindowMode.Custom) { InitializeComponent(); var x = (SplashScreenService)splashScreenService; x.ActionChanged += OnFoobar; }
public void OnLoaded() { _dispatcherService = this.GetService<IDispatcherService>(); _splashScreenService = this.GetService<ISplashScreenService>(); _frameService = this.GetService<INavigationService>(); var plugins = IoC.Instance.GetAllInstances<IPlugin>(); Plugins = new ObservableCollection<IPlugin>(plugins); SelectedPlugin = Plugins.FirstOrDefault(); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel" /> class. /// </summary> /// <param name="pleaseWaitService">The please wait service.</param> /// <param name="splashScreenService"></param> public MainWindowViewModel(IPleaseWaitService pleaseWaitService, ISplashScreenService splashScreenService) { _pleaseWaitService = pleaseWaitService; _splashScreenService = splashScreenService; IndeterminateCommand = new Command(IndeterminateCommandExecute); ShowProgressCommand = new Command(ShowProgressCommandExecute); ShowProgressWithSplashScreenCommand = new Command(ShowProgressWithSplashScreenCommandExecute); ShowProgressWithSplashScreenDetailedCommand = new Command(ShowProgressWithSplashScreenDetailedCommandExecute); ShowProgressInRegionCommand = new Command(ShowProgressInRegionCommandExecute); ShowProgressWithSplashScreenMoreDetailedCommand = new Command(ShowProgressWithSplashScreenMoreDetailedCommandExecute); }
/// <summary> /// Initializes a new instance of the <see cref="ShellService" /> class. /// </summary> /// <param name="typeFactory">The type factory.</param> /// <param name="commandManager">The command manager.</param> /// <param name="keyboardMappingsService">The keyboard mappings service.</param> /// <param name="splashScreenService"></param> /// <exception cref="ArgumentNullException">The <paramref name="typeFactory" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="commandManager" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="keyboardMappingsService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="splashScreenService" /> is <c>null</c>.</exception> public ShellService(ITypeFactory typeFactory, ICommandManager commandManager, IKeyboardMappingsService keyboardMappingsService, ISplashScreenService splashScreenService) { Argument.IsNotNull("typeFactory", typeFactory); Argument.IsNotNull("commandManager", commandManager); Argument.IsNotNull("keyboardMappingsService", keyboardMappingsService); Argument.IsNotNull("splashScreenService", splashScreenService); _typeFactory = typeFactory; _commandManager = commandManager; _keyboardMappingsService = keyboardMappingsService; _splashScreenService = splashScreenService; }
public MasterViewModel() { _logger = LogManager.GetLogger(GetType()); _WaitIndicatorService = DevExpress.Mvvm.ServiceContainer.Default.GetService <ISplashScreenService>("WaitIndicatorService"); Messenger.Default.Register <Document>( recipient: this, token: MessageTokenEnum.DocumentClipboardChanged, action: doc => ClipboardContent = doc?.DocumentFileName); Messenger.Default.Register <object>( recipient: this, token: MessageTokenEnum.CloseUserControl, action: (vm) => ChildView = null); }
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(); }
/// <summary> /// Initializes a new instance of the <see cref="ShellService" /> class. /// </summary> /// <param name="typeFactory">The type factory.</param> /// <param name="commandManager">The command manager.</param> /// <param name="keyboardMappingsService">The keyboard mappings service.</param> /// <param name="splashScreenService">The splash screen service.</param> /// <param name="ensureStartupService">The ensure startup service.</param> /// <param name="applicationInitializationService">The application initialization service.</param> /// <exception cref="ArgumentNullException">The <paramref name="typeFactory" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="commandManager" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="keyboardMappingsService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="splashScreenService" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="applicationInitializationService" /> is <c>null</c>.</exception> public ShellService(ITypeFactory typeFactory, ICommandManager commandManager, IKeyboardMappingsService keyboardMappingsService, ISplashScreenService splashScreenService, IEnsureStartupService ensureStartupService, IApplicationInitializationService applicationInitializationService) { Argument.IsNotNull(() => typeFactory); Argument.IsNotNull(() => commandManager); Argument.IsNotNull(() => keyboardMappingsService); Argument.IsNotNull(() => splashScreenService); Argument.IsNotNull(() => ensureStartupService); Argument.IsNotNull(() => applicationInitializationService); _typeFactory = typeFactory; _commandManager = commandManager; _keyboardMappingsService = keyboardMappingsService; _splashScreenService = splashScreenService; _ensureStartupService = ensureStartupService; _applicationInitializationService = applicationInitializationService; }
static void VerifyService(ISplashScreenService service) { if(service == null) throw new ArgumentNullException("service"); }
public static Task ShowSplashScreen(this ISplashScreenService service) { VerifyService(service); return(service.ShowSplashScreen(null)); }
public DocumentSearchSelectionPaneViewModel() { RefreshData(); _WaitIndicatorService = DevExpress.Mvvm.ServiceContainer.Default.GetService <ISplashScreenService>("WaitIndicatorService"); }
public MainVM() { _waitIndicatorService = ServiceContainer.Default.GetService <ISplashScreenService>("WaitIndicatorService"); }
public static void ShowSplashScreen(this ISplashScreenService service) { VerifyService(service); service.ShowSplashScreen(null); }
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); }