C# Class SonarLint.VisualStudio.Progress.Observation.ProgressObserver

Observes the execution progress of IProgressController and visualizes it using the supplied IProgressVisualizer
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe. Any instance members are not guaranteed to be accessible from a non-UI threads.
Inheritance: IDisposable
Show file Open project: SonarSource-VisualStudio/sonarlint-visualstudio Class Usage Examples

Private Properties

Property Type Description
ChangeCancellability void
CheckSupportedController void
CheckSupportedProgressEvents void
ControllerFinished void
ControllerStarted void
CreateAndConfigureInstance ProgressObserver
Dispose void
GetCompletedStepCount double
GroupToExecutionUnits ExecutionGroup[]
InitializeStep void
InitializeStepViewModels void
OnCancellationSupportChanged void
OnStepExecutionChanged void
ProgressObserver SonarLint.VisualStudio.Progress.MVVM
StartObserving ProgressObserver
StartObserving ProgressObserver
StartObserving ProgressObserver
StartObserving ProgressObserver
StartObserving ProgressObserver
StartObserving ProgressObserver
ThrowIfDisposed void
UpdateMainProgress void
UpdateViewModelStep void

Public Methods

Method Description
Dispose ( ) : void

The class will dispose itself once the controller has finished

StopObserving ( ProgressObserver observer ) : void

Stops the specified ProgressObserver from observing. The method is thread safe.

Private Methods

Method Description
ChangeCancellability ( bool cancellable ) : void
CheckSupportedController ( IProgressController progressController ) : void

Checks if the IProgressController meets the requirements to be observable by this class

CheckSupportedProgressEvents ( IProgressEvents progressEvents ) : void

Checks if the IProgressEvents meets the requirements to be observable by this class

ControllerFinished ( object sender, ProgressControllerFinishedEventArgs e ) : void
ControllerStarted ( object sender, ProgressEventArgs e ) : void
CreateAndConfigureInstance ( IServiceProvider serviceProvider, IProgressVisualizer visualizer, IProgressEvents progressEvents, ICommand cancelCommand, ProgressControllerViewModel state ) : ProgressObserver
Dispose ( bool disposing ) : void
GetCompletedStepCount ( IEnumerable steps ) : double
GroupToExecutionUnits ( IEnumerable steps ) : ExecutionGroup[]

Steps could be hidden which means that they won't be visible. In that case the progress needs to be scaled to accommodate for those steps and also the visual indicator that a step is running needs be conceptually correct - which means that all the hidden steps needed to be aggregated to a non-hidden one for visualization purposes.

InitializeStep ( ProgressStepViewModel viewModel, ExecutionGroup group ) : void

Sets the initial state of a ProgressStepViewModel

InitializeStepViewModels ( ) : void
OnCancellationSupportChanged ( object sender, CancellationSupportChangedEventArgs e ) : void
OnStepExecutionChanged ( object sender, StepExecutionChangedEventArgs e ) : void
ProgressObserver ( IServiceProvider serviceProvider, IProgressVisualizer host, IProgressEvents progressEvents, ProgressControllerViewModel state ) : SonarLint.VisualStudio.Progress.MVVM
StartObserving ( IProgressController controller ) : ProgressObserver
StartObserving ( IProgressController controller, IProgressVisualizer visualizer ) : ProgressObserver
StartObserving ( IProgressController controller, IProgressVisualizer visualizer, ProgressControllerViewModel state ) : ProgressObserver
StartObserving ( IServiceProvider serviceProvider, IProgressEvents progressEvents ) : ProgressObserver
StartObserving ( IServiceProvider serviceProvider, IProgressEvents progressEvents, IProgressVisualizer visualizer ) : ProgressObserver
StartObserving ( IServiceProvider serviceProvider, IProgressEvents progressEvents, IProgressVisualizer visualizer, ProgressControllerViewModel state ) : ProgressObserver
ThrowIfDisposed ( ) : void
UpdateMainProgress ( StepExecutionChangedEventArgs e ) : void

Updates the main progress based on the number of steps in final state an the current step being executed. Each IProgressStep which impacts progress will have one "slot" in the main progress bar.

UpdateViewModelStep ( StepExecutionChangedEventArgs e ) : void

Updates the ProgressStepViewModel with the current step changes. The ProgressStepViewModel represents a ExecutionGroup of one visible step and zero or more hidden steps. The progress in ProgressStepViewModel is used as the sub progress and it will be indeterminate if there's one indeterminate IProgressStep in ExecutionGroup, otherwise the sub progress will be relative to the number of steps in ExecutionGroup.

Method Details

Dispose() public method

The class will dispose itself once the controller has finished
public Dispose ( ) : void
return void

StopObserving() public static method

Stops the specified ProgressObserver from observing. The method is thread safe.
public static StopObserving ( ProgressObserver observer ) : void
observer ProgressObserver An existing to stop observing with
return void