diff --git a/Apewer/RuntimeUtility.cs b/Apewer/RuntimeUtility.cs
index 836cf7e..316f5e9 100644
--- a/Apewer/RuntimeUtility.cs
+++ b/Apewer/RuntimeUtility.cs
@@ -629,6 +629,25 @@ namespace Apewer
return thread;
}
+ /// 在后台线程中执行,指定 Try 将忽略 Action 抛出的异常。
+ /// 延迟的毫秒数。
+ /// 要执行的 Action。
+ /// 忽略 Action 抛出的异常。
+ /// 对返回的 Thread 调用 Abort 可结束线程的执行。
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static Thread InBackground(int delay, Action action, bool @try = false)
+ {
+ if (action == null) return null;
+ var thread = new Thread(delegate (object v)
+ {
+ if (delay > 0) Thread.Sleep(delay);
+ Invoke(() => ((Action)v)(), @try);
+ });
+ thread.IsBackground = true;
+ thread.Start(action);
+ return thread;
+ }
+
/// 启动线程,在新线程中执行。
/// 要执行的 Action。
/// 设置线程为后台线程。