I'm simple trying to show a WPF Window from a Console App. In my solution I got a console application which is the startup project and creates a Wpf Window like this:
class Program
{
[STAThread]
static void Main(string[] args)
{
var thread = new Thread(Foo);
thread.Start();
Console.ReadKey();
}
private static void Foo()
{
var markerService = new MarkerService();
var viewModel = new MainViewModel();
markerService.Register(viewModel);
var mainView = new MainWindow { DataContext = viewModel };
mainView.Show();
}
}
MainWindow
and MainViewModel
are just empty. When I start the project The Wpf Window is shown but doesn't respond (cursor is busy).
Any help is appreciated.
regards
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…