Beispiel #1
0
        public List <string> GetDbContextNames(FindDbContextSubtypeParams commandParams)
        {
            var result = runMigratorProcess(commandParams);

            if (!string.IsNullOrEmpty(result.error))
            {
#pragma warning disable VSTHRD110 // Observe result of async calls
                _messageBoxService.ShowErrorMessage(result.error);
#pragma warning restore VSTHRD110 // Observe result of async calls
            }

            if (result.exitCode == ExitCode.Success)
            {
                if (!string.IsNullOrWhiteSpace(result.output))
                {
                    return(result.output.Split(';').ToList());
                }
            }
            else if (result.exitCode == ExitCode.Exception && !string.IsNullOrWhiteSpace(result.output))
            {
#pragma warning disable VSTHRD110 // Observe result of async calls
                _messageBoxService.ShowErrorMessage(result.output);
#pragma warning restore VSTHRD110 // Observe result of async calls
            }

            return(new List <string>());
        }
        public ManagementViewModel([Dependency(Dispatchers.Current)] IDispatcherProvider dispatcher,
                                   IMessageBoxService messageBoxService,
                                   IThreadsController threadsController)
        {
            threadsController.Result.Subscribe(r =>
            {
                if (r.Result == Result.Error)
                {
                    messageBoxService.ShowErrorMessage(r.Exception.ToString(), "Error");
                }
                else
                {
                    messageBoxService.ShowInformation(r.Result.ToString(), "Information");
                }
            });

            Progress =
                threadsController.Progress
                .Sample(TimeSpan.FromMilliseconds(50))
                .ToReactiveProperty(dispatcher.Scheduler);

            BufferSize =
                threadsController.CurrentBufferSize
                .Sample(TimeSpan.FromMilliseconds(50))
                .ToReactiveProperty(dispatcher.Scheduler);

            ReaderState = threadsController.ReaderState.ToReactiveProperty(dispatcher.Scheduler);
            WriterState = threadsController.WriterState.ToReactiveProperty(dispatcher.Scheduler);

            PauseReading = threadsController.ReaderState.Select(x => x == WorkerState.Running)
                           .ToReactiveCommand(dispatcher.Scheduler);
            PauseReading.Subscribe(threadsController.PauseReading);

            ResumeReading = threadsController.ReaderState.Select(x => x == WorkerState.Suspended)
                            .ToReactiveCommand(dispatcher.Scheduler);
            ResumeReading.Subscribe(threadsController.ResumeReading);


            PauseWriting = threadsController.WriterState.Select(x => x == WorkerState.Running)
                           .ToReactiveCommand(dispatcher.Scheduler);
            PauseWriting.Subscribe(threadsController.PauseWriting);

            ResumeWriting = threadsController.WriterState.Select(x => x == WorkerState.Suspended)
                            .ToReactiveCommand(dispatcher.Scheduler);
            ResumeWriting.Subscribe(threadsController.ResumeWriting);
        }