From 905531f2db38d9ca325bfa2bcb6292da06f4153f Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 10 Oct 2023 15:53:34 +0800 Subject: [PATCH] style: show progress bar in taskbar while popup is running --- src/Views/Clone.xaml | 5 +++++ src/Views/Clone.xaml.cs | 3 +++ src/Views/Launcher.xaml | 7 ++++++- src/Views/Widgets/Dashboard.xaml.cs | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Views/Clone.xaml b/src/Views/Clone.xaml index b257885a..07536e82 100644 --- a/src/Views/Clone.xaml +++ b/src/Views/Clone.xaml @@ -12,6 +12,11 @@ Title="{DynamicResource Text.Clone}" Width="500" SizeToContent="Height" ResizeMode="NoResize"> + + + + + diff --git a/src/Views/Clone.xaml.cs b/src/Views/Clone.xaml.cs index 4161fbf9..afce1aed 100644 --- a/src/Views/Clone.xaml.cs +++ b/src/Views/Clone.xaml.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Shell; namespace SourceGit.Views { @@ -35,6 +36,7 @@ namespace SourceGit.Views { if (Validation.GetHasError(edit)) return; } + TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate; progress.Visibility = Visibility.Visible; processing.IsAnimating = true; @@ -78,6 +80,7 @@ namespace SourceGit.Views { return true; }); + TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; progress.Visibility = Visibility.Collapsed; processing.IsAnimating = false; if (succ) { diff --git a/src/Views/Launcher.xaml b/src/Views/Launcher.xaml index ae2a8d4d..d3fef695 100644 --- a/src/Views/Launcher.xaml +++ b/src/Views/Launcher.xaml @@ -15,7 +15,12 @@ Width="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Width, Mode=TwoWay}" Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}" WindowState="{Binding Source={x:Static models:Preference.Instance}, Path=Window.State, Mode=TwoWay}" - Closing="OnClosing"> + Closing="OnClosing"> + + + + + diff --git a/src/Views/Widgets/Dashboard.xaml.cs b/src/Views/Widgets/Dashboard.xaml.cs index 02fe2ba6..06c4535d 100644 --- a/src/Views/Widgets/Dashboard.xaml.cs +++ b/src/Views/Widgets/Dashboard.xaml.cs @@ -10,6 +10,7 @@ using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; +using System.Windows.Shell; namespace SourceGit.Views.Widgets { @@ -154,14 +155,18 @@ namespace SourceGit.Views.Widgets { isPopupLocked = true; popupProgressMask.Visibility = Visibility.Visible; processing.IsAnimating = true; + App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate; var task = curPopup.Start(); if (task != null) { var close = await task; + App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; if (close) { ClosePopups(true); return; } + } else { + App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; } isPopupLocked = false;