mirror of
https://github.com/psforever/GameLauncher.git
synced 2026-03-28 00:29:14 +00:00
24 lines
535 B
C#
24 lines
535 B
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
namespace PSLauncher
|
|||
|
|
{
|
|||
|
|
public static class ISynchronizeInvokeExtensions
|
|||
|
|
{
|
|||
|
|
public static void SafeInvoke<T>(this T @this, Action<T> action) where T : ISynchronizeInvoke
|
|||
|
|
{
|
|||
|
|
if (@this.InvokeRequired)
|
|||
|
|
{
|
|||
|
|
@this.Invoke(action, new object[] { @this });
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
action(@this);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|