using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SVS.ThreadHelper
{
public static class ThreadSafe
{
public static void InvokeExt<T>(this T t, Action method, params object[] args)
where T : Control
{
if (t.InvokeRequired)
{
t.Invoke(method, args);
}
else
{
method.Method.Invoke(t, args);
}
}
public static void InvokeExt<T>(this T t, Action method)
where T : Control
{
if (t.InvokeRequired)
{
t.Invoke(method);
}
else
{
method.Method.Invoke(t, null);
}
}
}
}