style<Window>: show progress bar in taskbar while popup is running

This commit is contained in:
leo 2023-10-10 15:53:34 +08:00
parent 951a38d445
commit 905531f2db
4 changed files with 19 additions and 1 deletions

View file

@ -12,6 +12,11 @@
Title="{DynamicResource Text.Clone}" Title="{DynamicResource Text.Clone}"
Width="500" SizeToContent="Height" Width="500" SizeToContent="Height"
ResizeMode="NoResize"> ResizeMode="NoResize">
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressState="None"/>
</Window.TaskbarItemInfo>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="28"/> <RowDefinition Height="28"/>

View file

@ -4,6 +4,7 @@ using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Shell;
namespace SourceGit.Views { namespace SourceGit.Views {
@ -35,6 +36,7 @@ namespace SourceGit.Views {
if (Validation.GetHasError(edit)) return; if (Validation.GetHasError(edit)) return;
} }
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;
progress.Visibility = Visibility.Visible; progress.Visibility = Visibility.Visible;
processing.IsAnimating = true; processing.IsAnimating = true;
@ -78,6 +80,7 @@ namespace SourceGit.Views {
return true; return true;
}); });
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
progress.Visibility = Visibility.Collapsed; progress.Visibility = Visibility.Collapsed;
processing.IsAnimating = false; processing.IsAnimating = false;
if (succ) { if (succ) {

View file

@ -16,6 +16,11 @@
Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, 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}" WindowState="{Binding Source={x:Static models:Preference.Instance}, Path=Window.State, Mode=TwoWay}"
Closing="OnClosing"> Closing="OnClosing">
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressState="None"/>
</Window.TaskbarItemInfo>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="{Binding ElementName=me, Path=WindowState, Converter={StaticResource WindowStateToTitleBarHeight}}"/> <RowDefinition Height="{Binding ElementName=me, Path=WindowState, Converter={StaticResource WindowStateToTitleBarHeight}}"/>

View file

@ -10,6 +10,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Shell;
namespace SourceGit.Views.Widgets { namespace SourceGit.Views.Widgets {
@ -154,14 +155,18 @@ namespace SourceGit.Views.Widgets {
isPopupLocked = true; isPopupLocked = true;
popupProgressMask.Visibility = Visibility.Visible; popupProgressMask.Visibility = Visibility.Visible;
processing.IsAnimating = true; processing.IsAnimating = true;
App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;
var task = curPopup.Start(); var task = curPopup.Start();
if (task != null) { if (task != null) {
var close = await task; var close = await task;
App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
if (close) { if (close) {
ClosePopups(true); ClosePopups(true);
return; return;
} }
} else {
App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
} }
isPopupLocked = false; isPopupLocked = false;