I need to have some parameters in my MainWindow, like so:
public MainWindow(DbContext _ctx, string dbSetName)
{
Type setType = Type.GetType(dbSetName);
Type gType = typeof(GenericViewModel<>).MakeGenericType(setType);
var oVM = Activator.CreateInstance(gType);
this.DataContext = oVM;
InitializeComponent();
}
And now I want to show the MainWindow from a different project:
var w = new MainWindow (PersonCbContext, "People"
I get an exception saying:
"The calling thread must be STA, because many UI components require this."