InvalidOperationException: 调用线程必须为 STA,因为许多 UI 组件都需要。 StackTrace: 在 System.Windows.Input.InputManager..ctor() 在 System.Windows.Input.InputManager.GetCurrentInputManagerImpl() 在 System.Windows.Input.KeyboardNavigation..ctor() 在 System.Windows.FrameworkElement.FrameworkServices..ctor() 在 System.Windows.FrameworkElement.EnsureFrameworkServices() 在 System.Windows.FrameworkElement..ctor() 在 DynamicClass.Script.CreateAccountItem(String issuer, String label, AccountInfo accountInfo, String iconUrl, Int32 index) 在 DynamicClass.Script.<>c__DisplayClass15.<LoadAccounts>b__13(Object param0) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 在 System.Threading.ThreadPoolWorkQueue.Dispatch()