Clean up imagefetcher for net10/cross thread safety

This commit is contained in:
DESKTOP-SN9KF5O\Strawberry
2026-01-17 02:34:59 +00:00
parent 5152881568
commit 3d9d10bb97
2 changed files with 63 additions and 39 deletions

View File

@@ -0,0 +1,22 @@
using System;
using System.Windows.Forms;
namespace NHSE.WinForms;
public static class CrossThreadExtensions
{
/// <summary>
/// Helper function to perform an action on a Control's thread safely.
/// </summary>
public static void PerformSafely(this Control target, Action action)
{
if (target.InvokeRequired)
{
target.Invoke(action);
}
else
{
action();
}
}
}