[GUI] Display progress in the taskbar button

This commit is contained in:
VaDiM 2023-06-05 01:33:48 +03:00
parent 2f8f57c1a6
commit 547659e151
2 changed files with 17 additions and 1 deletions

View File

@ -65,6 +65,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft-WindowsAPICodePack-Core-6.0" Version="1.1.5" />
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell-6.0" Version="1.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

View File

@ -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();
}