我编写了最简单的 WPF Prism 应用程序。它不会关闭。
应用程序.xaml
<Application x:Class="PrismApp.Desktop.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Shell.xaml"
ShutdownMode="OnMainWindowClose">
<Application.Resources>
</Application.Resources>
</Application>
应用程序.xaml.cs
namespace PrismApp.Desktop
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Bootstrapper bootstrapper = new Bootstrapper();
bootstrapper.Run();
}
}
}
引导程序.cs
namespace PrismApp.Desktop
{
class Bootstrapper : UnityBootstrapper
{
protected override System.Windows.DependencyObject CreateShell()
{
var shell = new Shell();
return shell;
}
protected override void ConfigureModuleCatalog()
{
base.ConfigureModuleCatalog();
}
}
}
壳牌.xaml
<Window x:Class="PrismApp.Desktop.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Shell" Height="350" Width="525">
<Grid>
</Grid>
</Window>
为什么会这样?