8bb0f158b5
- proj di base con le 2 form da ereditare - progetto globale che contiene TUTTI gli adapter (pronto a venire spezzettato - gettate le basi x "portare fuori" i vari componenti oppure fare compilazione condizonale
36 lines
858 B
C#
36 lines
858 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace IOB_WIN_FORM
|
|
{
|
|
/// <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
|
|
}
|
|
} |