Browse Source

Fix #593: Set progressBar.IsIndeterminate=false if the progress bar is invisible to avoid unnecessarily rendering at 60 FPS.

pull/681/head
Daniel Grunwald 10 years ago
parent
commit
9af32372b0
  1. 4
      ILSpy/TextView/DecompilerTextView.cs
  2. 2
      ILSpy/TextView/DecompilerTextView.xaml

4
ILSpy/TextView/DecompilerTextView.cs

@ -233,6 +233,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -233,6 +233,9 @@ namespace ICSharpCode.ILSpy.TextView
{
if (waitAdorner.Visibility != Visibility.Visible) {
waitAdorner.Visibility = Visibility.Visible;
// Work around a WPF bug by setting IsIndeterminate only while the progress bar is visible.
// https://github.com/icsharpcode/ILSpy/issues/593
progressBar.IsIndeterminate = true;
waitAdorner.BeginAnimation(OpacityProperty, new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5)), FillBehavior.Stop));
var taskBar = MainWindow.Instance.TaskbarItemInfo;
if (taskBar != null) {
@ -260,6 +263,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -260,6 +263,7 @@ namespace ICSharpCode.ILSpy.TextView
if (currentCancellationTokenSource == myCancellationTokenSource) {
currentCancellationTokenSource = null;
waitAdorner.Visibility = Visibility.Collapsed;
progressBar.IsIndeterminate = false;
var taskBar = MainWindow.Instance.TaskbarItemInfo;
if (taskBar != null) {
taskBar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;

2
ILSpy/TextView/DecompilerTextView.xaml

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
<Border Name="waitAdorner" Background="#C0FFFFFF" Visibility="Collapsed">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontSize="14pt">Decompiling...</TextBlock>
<ProgressBar IsIndeterminate="True" Height="16" Margin="0, 4" />
<ProgressBar Name="progressBar" Height="16" Margin="0, 4" />
<Button Click="cancelButton_Click" HorizontalAlignment="Center">Cancel</Button>
</StackPanel>
</Border>

Loading…
Cancel
Save