I have to develop a WPF application and use Caliburn.Micro to provide MVVM. But this time the view models are located in a separate class library.
All works fine, until I want to close the application. Because the view models are in a separate assembly, they can't access the applicatuion class of the WPF application. So I can't use System.Windows.Application.Current.Shutdown() to close the application, like I did in my former applications.
So how can I exit the application under this conditions?
Info about the existing class hierarchy: ViewModelBase is an abstract base class for all my view models. It derives from Caliburn.Micro.PropertyChangedBase and provides the functionality for IoC, the window manager and the event aggregator.
Inherit from Caliburn.Micro.Screen, which derives from PropertyChangedBase through ViewAware, and call TryClose().
Or call just call System.Environment.Exit(0).
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