A view model data class that is used in ProgressObserverControl supplied by IProgressVisualizer
상속: ViewModelBase
        public void ProgressControllerViewModel_AllPublicPropertiesNotifyChanges()
        {
            ProgressControllerViewModel model = new ProgressControllerViewModel();
            ProgressStepViewModel step = new ProgressStepViewModel();
            model.Steps.Add(step);

            ViewModelVerifier.RunVerificationTest<ProgressControllerViewModel, string>(model, "Title", "value1", "value2");
            ViewModelVerifier.RunVerificationTest<ProgressControllerViewModel, ProgressStepViewModel>(model, "Current", null, step);
            ViewModelVerifier.RunVerificationTest<ProgressControllerViewModel, bool>(model, "Cancellable", true, false);
            ViewModelVerifier.RunVerificationTest<ProgressControllerViewModel, ICommand>(model, "CancelCommand", null, new RelayCommand((s) => { }));
        }
        internal ProgressObserver(IServiceProvider serviceProvider, IProgressVisualizer host, IProgressEvents progressEvents, ProgressControllerViewModel state)
        {
            // Event registration must be on the UI thread
            ThreadHelper.ThrowIfNotOnUIThread();

            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (progressEvents == null)
            {
                throw new ArgumentNullException(nameof(progressEvents));
            }

            Debug.Assert(progressEvents.Steps != null, "Expected to be initialized");

            this.serviceProvider = serviceProvider;
            this.host = host;
            this.progressEvents = progressEvents;

            this.progressEvents.Started += this.ControllerStarted;
            this.progressEvents.Finished += this.ControllerFinished;
            this.progressEvents.StepExecutionChanged += this.OnStepExecutionChanged;
            this.progressEvents.CancellationSupportChanged += this.OnCancellationSupportChanged;

            this.viewModelRoot = state ?? new ProgressControllerViewModel();
            this.InitializeStepViewModels();

            this.host.ViewModel = this.viewModelRoot;
        }
 private static ProgressObserver CreateAndConfigureInstance(IServiceProvider serviceProvider, IProgressVisualizer visualizer, IProgressEvents progressEvents, ICommand cancelCommand, ProgressControllerViewModel state)
 {
     return VsThreadingHelper.RunInline(serviceProvider, VsTaskRunContext.UIThreadNormalPriority, () =>
     {
         ProgressObserver returnValue = new ProgressObserver(serviceProvider, visualizer, progressEvents, state);
         returnValue.CancelCommand = cancelCommand;
         return returnValue;
     }, null);
 }
        public static ProgressObserver StartObserving(IServiceProvider serviceProvider, IProgressEvents progressEvents, IProgressVisualizer visualizer, ProgressControllerViewModel state)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (progressEvents == null)
            {
                throw new ArgumentNullException(nameof(progressEvents));
            }

            if (visualizer == null)
            {
                throw new ArgumentNullException(nameof(visualizer));
            }

            CheckSupportedProgressEvents(progressEvents);

            ProgressObserver observer = CreateAndConfigureInstance(serviceProvider, visualizer, progressEvents, null, state);

            Debug.Assert(observer != null, "Failed to create observer on the UI thread");

            return observer;
        }
        public static ProgressObserver StartObserving(IProgressController controller, IProgressVisualizer visualizer, ProgressControllerViewModel state)
        {
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }

            if (visualizer == null)
            {
                throw new ArgumentNullException(nameof(visualizer));
            }

            CheckSupportedController(controller);
            ProgressObserver observer = CreateAndConfigureInstance((IServiceProvider)controller, visualizer, controller.Events, new RelayCommand((s) => controller.TryAbort()), state);

            Debug.Assert(observer != null, "Failed to create observer on the UI thread");

            return observer;
        }
 private void CreateTestSubject(ProgressControllerViewModel state = null)
 {
     this.testSubject = new ProgressObserver(this.testServiceProvider, this.testVisualizer, this.progressEvents, state);
     this.VerifyNonDisposedAndRegistered();
 }
 public void Reset()
 {
     this.viewModel = new ProgressControllerViewModel();
     this.isShown = false;
 }
 private static ProgressObserver CreateObserver(IProgressController controller, IProgressVisualizer visualizer, ProgressControllerViewModel state)
 {
     return ProgressObserver.StartObserving(controller, visualizer, state);
 }