I need to create a Form in a different thread and keep it ranning until a user performe some action in the main thread (click a button).
It is not very difficult to do using
System.Windows.Forms.Application.Run(new ApplicationContext());
that starts an application message loop in the current thread. But this solution requires the usage of System.Windows.Forms namespace, which in not a wpf namespace.
Do you know a wpf-way of achieving this goal? =)
P.S. without starting an application message loop the thread will be imidiatly terminated after processing of the last expression in it. So, the Form will appear only for a moment and will be closed. =(
Use System.Windows.Threading.Dispatcher.Run()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With