Displaying progress
If you'd like to show a progress bar during the installation, you can handle two events: CacheAcquireProgress
and ExecuteProgress
. The former will give you a percentage completed for caching the packages. The latter will give you a percentage for packages executed. To get a total progress percentage, we add them both together and divide by two—if we didn't divide by two we'd end up with a final result of 200 since both events count up to 100.
First, let's add a Label
control to our view that displays the percentage as text and also a ProgressBar
control to go with it. Here's the markup to add to our XAML file:
<WrapPanel Margin="10" > <Label VerticalAlignment="Center">Progress:</Label> <Label Content="{Binding Progress}" /> <ProgressBar Width="200" Height="30" Value="{Binding Progress}" Minimum="0" Maximum="100" /> </WrapPanel>
Our Label
and ProgressBar
controls...