/// <summary>
/// Updates the main progress based on the number of steps in final state
/// an the current step being executed. Each <see cref="IProgressStep"/> which impacts
/// progress will have one "slot" in the main progress bar.
/// </summary>
/// <param name="e">Execution update</param>
private void UpdateMainProgress(StepExecutionChangedEventArgs e)
{
ThreadHelper.ThrowIfNotOnUIThread();
double totalNumberOfSteps = this.ProgressImpactingSteps.Count();
double completedSteps = GetCompletedStepCount(this.ProgressImpactingSteps);
this.viewModelRoot.Current = this.progressStepToViewModelMapping[e.Step];
this.viewModelRoot.MainProgress.SetUpperBoundLimitedValue(completedSteps / totalNumberOfSteps);
// When a determinate step is executing take it's progress into account
if (!e.IsProgressIndeterminate() && e.State == StepExecutionState.Executing)
{
this.viewModelRoot.MainProgress.SetUpperBoundLimitedValue(this.viewModelRoot.MainProgress.Value + e.Progress / totalNumberOfSteps);
}
}