Files
Samuele Locatelli 11bb5b742e MTC - Net8
- move progetti core di MTC in net8 a scratch (da rivedere...)
2024-12-19 18:39:10 +01:00

36 lines
857 B
C#

using System;
using System.Windows.Forms;
namespace IOB_WIN_MTC
{
/// <summary>
/// Helper gestione UITHread e deleghe
/// https://www.codeproject.com/Articles/37642/Avoiding-InvokeRequired
/// </summary>
internal static class ControlExtensions
{
#region Public Methods
public static void UIThread(this Control control, Action code)
{
if (control.InvokeRequired)
{
control.BeginInvoke(code);
return;
}
code.Invoke();
}
public static void UIThreadInvoke(this Control control, Action code)
{
if (control.InvokeRequired)
{
control.Invoke(code);
return;
}
code.Invoke();
}
#endregion Public Methods
}
}