public RunInSta ( Action userDelegate ) : void | ||
userDelegate | Action | |
Résultat | void |
public void RunInSta(Action userDelegate)
{
lastException = null;
var thread = new Thread(() => MultiThreadedWorker(() => userDelegate()));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
if (lastException != null)
{
ThrowExceptionPreservingStack(lastException);
}
}
public void LaunchEmpty() { var runner = new CrossThreadRunner(); runner.RunInSta(() => { var configureWindow = new ConfigureWindow(new ConfigureWindowModel()); configureWindow.ShowDialog(); }); }