|
1 |
| - |
2 |
| -using System; |
| 1 | +using System; |
3 | 2 | using System.ComponentModel;
|
4 | 3 | using System.Windows;
|
5 | 4 | using System.Windows.Input;
|
@@ -27,6 +26,7 @@ public partial class MainWindow
|
27 | 26 | #region Private Fields
|
28 | 27 |
|
29 | 28 | private readonly Storyboard _progressBarStoryboard = new Storyboard();
|
| 29 | + private bool isProgressBarStoryboardPaused; |
30 | 30 | private Settings _settings;
|
31 | 31 | private NotifyIcon _notifyIcon;
|
32 | 32 | private MainViewModel _viewModel;
|
@@ -86,32 +86,34 @@ private void OnLoaded(object sender, RoutedEventArgs _)
|
86 | 86 | _viewModel.LastQuerySelected = true;
|
87 | 87 | }
|
88 | 88 |
|
89 |
| - if (_viewModel.ProgressBarVisibility == Visibility.Visible) |
| 89 | + if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused) |
90 | 90 | {
|
91 | 91 | _progressBarStoryboard.Resume();
|
| 92 | + isProgressBarStoryboardPaused = false; |
92 | 93 | }
|
93 | 94 | }
|
94 |
| - else |
| 95 | + else if (!isProgressBarStoryboardPaused) |
95 | 96 | {
|
96 | 97 | _progressBarStoryboard.Pause();
|
| 98 | + isProgressBarStoryboardPaused = true; |
97 | 99 | }
|
98 | 100 | }
|
99 | 101 | else if (e.PropertyName == nameof(MainViewModel.ProgressBarVisibility))
|
100 | 102 | {
|
101 | 103 | Dispatcher.Invoke(() =>
|
102 | 104 | {
|
103 |
| - if (_viewModel.ProgressBarVisibility == Visibility.Hidden) |
| 105 | + if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused) |
104 | 106 | {
|
105 | 107 | _progressBarStoryboard.Pause();
|
| 108 | + isProgressBarStoryboardPaused = true; |
106 | 109 | }
|
107 |
| - else if (Visibility == Visibility.Visible) |
| 110 | + else if (Visibility == Visibility.Visible && isProgressBarStoryboardPaused) |
108 | 111 | {
|
109 | 112 | _progressBarStoryboard.Resume();
|
| 113 | + isProgressBarStoryboardPaused = false; |
110 | 114 | }
|
111 | 115 | }, System.Windows.Threading.DispatcherPriority.Render);
|
112 |
| - |
113 | 116 | }
|
114 |
| - |
115 | 117 | };
|
116 | 118 | _settings.PropertyChanged += (o, e) =>
|
117 | 119 | {
|
@@ -196,6 +198,7 @@ private void InitProgressbarAnimation()
|
196 | 198 | _progressBarStoryboard.RepeatBehavior = RepeatBehavior.Forever;
|
197 | 199 | ProgressBar.BeginStoryboard(_progressBarStoryboard);
|
198 | 200 | _viewModel.ProgressBarVisibility = Visibility.Hidden;
|
| 201 | + isProgressBarStoryboardPaused = true; |
199 | 202 | }
|
200 | 203 |
|
201 | 204 | private void OnMouseDown(object sender, MouseButtonEventArgs e)
|
|
0 commit comments