22 行
421 B
C#
22 行
421 B
C#
using System.Windows;
|
|
|
|
namespace ProxyForge;
|
|
|
|
internal static class UiThread
|
|
{
|
|
public static void Post(Action action)
|
|
{
|
|
var dispatcher = Application.Current?.Dispatcher;
|
|
if (dispatcher is null || dispatcher.CheckAccess())
|
|
{
|
|
action();
|
|
return;
|
|
}
|
|
|
|
if (dispatcher.HasShutdownStarted)
|
|
return;
|
|
|
|
dispatcher.InvokeAsync(action);
|
|
}
|
|
}
|