Completato test modalità PubSub REDIS x steamwarelibs

This commit is contained in:
Samuele Locatelli
2022-04-09 09:44:40 +02:00
parent 8aa9c8c6b7
commit 38f12b7d7e
4 changed files with 183 additions and 78 deletions
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Windows.Forms;
namespace TestBench
{
/// <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
}
}