Example #1
0
        /// <inheritdoc />
        public virtual T Run <T>(TaskWithProgress <T> task)
        {
            IProgressMonitorPresenter presenter = GetPresenter();

            using (var progressMonitor = new ObservableProgressMonitor())
            {
                presenter.Present(progressMonitor);
                progressMonitor.ThrowIfCanceled();
                T result = task(progressMonitor);
                progressMonitor.ThrowIfCanceled();
                return(result);
            }
        }
        public T Run <T>(TaskWithProgress <T> task)
        {
            IProgressMonitorPresenter presenter = new ProgressMonitorPresenter(_executionRecorder);

            using (var progressMonitor = new ObservableProgressMonitor())
            {
                presenter.Present(progressMonitor);
                progressMonitor.ThrowIfCanceled();
                T result = task(progressMonitor);
                progressMonitor.ThrowIfCanceled();
                return(result);
            }
        }