mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
fix<Launcher>: TaskbarItemInfo.ProgressState should disappears only when all tasks are complete
This commit is contained in:
parent
918eb48663
commit
c85052bbcc
2 changed files with 24 additions and 3 deletions
|
@ -7,6 +7,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.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Shell;
|
||||||
|
|
||||||
namespace SourceGit.Views {
|
namespace SourceGit.Views {
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ namespace SourceGit.Views {
|
||||||
/// 主窗体
|
/// 主窗体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Launcher : Controls.Window {
|
public partial class Launcher : Controls.Window {
|
||||||
|
private int taskBarProgressRequest = 0;
|
||||||
|
|
||||||
public Launcher() {
|
public Launcher() {
|
||||||
Models.Watcher.Opened += OpenRepository;
|
Models.Watcher.Opened += OpenRepository;
|
||||||
|
@ -21,6 +23,22 @@ namespace SourceGit.Views {
|
||||||
tabs.Add();
|
tabs.Add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region TASKBAR_PROGRESS
|
||||||
|
public void IncreaseProgressBar() {
|
||||||
|
if (taskBarProgressRequest == 0) TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;
|
||||||
|
taskBarProgressRequest++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DecreaseProgressBar() {
|
||||||
|
taskBarProgressRequest--;
|
||||||
|
if (taskBarProgressRequest <= 0) {
|
||||||
|
taskBarProgressRequest = 0;
|
||||||
|
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region WINDOW_EVENTS
|
||||||
private void OnClosing(object sender, CancelEventArgs e) {
|
private void OnClosing(object sender, CancelEventArgs e) {
|
||||||
var restore = Models.Preference.Instance.Restore;
|
var restore = Models.Preference.Instance.Restore;
|
||||||
if (!restore.IsEnabled) return;
|
if (!restore.IsEnabled) return;
|
||||||
|
@ -46,6 +64,7 @@ namespace SourceGit.Views {
|
||||||
|
|
||||||
Models.Preference.Save();
|
Models.Preference.Save();
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region OPEN_REPO
|
#region OPEN_REPO
|
||||||
private void OpenRepository(Models.Repository repo) {
|
private void OpenRepository(Models.Repository repo) {
|
||||||
|
|
|
@ -155,18 +155,20 @@ 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 launcher = App.Current.MainWindow as Launcher;
|
||||||
|
launcher.IncreaseProgressBar();
|
||||||
|
|
||||||
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;
|
launcher.DecreaseProgressBar();
|
||||||
if (close) {
|
if (close) {
|
||||||
ClosePopups(true);
|
ClosePopups(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
App.Current.MainWindow.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
|
launcher.DecreaseProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
isPopupLocked = false;
|
isPopupLocked = false;
|
||||||
|
|
Loading…
Reference in a new issue