From 547659e1518aa73c81bf5d3849707fc7fef28f4f Mon Sep 17 00:00:00 2001 From: VaDiM Date: Mon, 5 Jun 2023 01:33:48 +0300 Subject: [PATCH] [GUI] Display progress in the taskbar button --- AssetStudioGUI/AssetStudioGUI.csproj | 2 ++ AssetStudioGUI/AssetStudioGUIForm.cs | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/AssetStudioGUI/AssetStudioGUI.csproj b/AssetStudioGUI/AssetStudioGUI.csproj index c0b9b21..96a68fb 100644 --- a/AssetStudioGUI/AssetStudioGUI.csproj +++ b/AssetStudioGUI/AssetStudioGUI.csproj @@ -65,6 +65,8 @@ + + diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 8828543..b158d1f 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -19,6 +19,7 @@ using System.Timers; using System.Windows.Forms; using static AssetStudioGUI.Studio; using Font = AssetStudio.Font; +using Microsoft.WindowsAPICodePack.Taskbar; #if NET472 using Vector3 = OpenTK.Vector3; using Vector4 = OpenTK.Vector4; @@ -106,6 +107,8 @@ namespace AssetStudioGUI private GUILogger logger; + private TaskbarManager taskbar = TaskbarManager.Instance; + [DllImport("gdi32.dll")] private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts); @@ -607,7 +610,7 @@ namespace AssetStudioGUI { listSearch.Text = ""; listSearch.ForeColor = SystemColors.WindowText; - BeginInvoke(new Action(() => enableFiltering = true)); + BeginInvoke(new Action(() => { enableFiltering = true; })); } } @@ -1303,6 +1306,16 @@ namespace AssetStudioGUI { progressBar1.Value = value; } + + BeginInvoke(new Action(() => + { + var max = progressBar1.Maximum; + taskbar.SetProgressValue(value, max); + if (value == max) + taskbar.SetProgressState(TaskbarProgressBarState.NoProgress); + else + taskbar.SetProgressState(TaskbarProgressBarState.Normal); + })); } private void StatusStripUpdate(string statusText) @@ -1354,6 +1367,7 @@ namespace AssetStudioGUI filterTypeToolStripMenuItem.DropDownItems.RemoveAt(1); } + taskbar.SetProgressState(TaskbarProgressBarState.NoProgress); FMODreset(); }