WPF多UI线程
internal class SpashWindowManager { private static SpashWindow _spashWindow; private static Thread thread; public static void Show() { thread = new Thread(() => { _spashWindow = new SpashWindow(); _spashWindow.Show(); try { Dispatcher.Run(); } catch (Exception e) { LogHelper.WriteLog(e.Message, LogType.Error); } }) { IsBackground = true }; thread.SetApartmentState(ApartmentState.STA); thread.Start(); } public static void Close() { Dispatcher.FromThread(thread)?.Invoke(() => { try { _spashWindow.Close(); } catch (Exception e) { LogHelper.WriteLog($" {e.StackTrace.ToString()} {e.Message}", LogType.Error); } }); } }