0
我写了最简单的WPF Prism应用程序。它不关机。WPF Prism应用程序不关机
的App.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>
App.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();
}
}
}
Bootstrapper.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();
}
}
}
Shell.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>
为什么会是这种情况?
只需从App.xaml中删除StartupUri =“Shell.xaml”,看看发生了什么?你仍然不允许引导程序加载你的Shell并且让StartupUri结束。 – 2012-01-12 05:36:03
初创Uri是你的问题。 Theck出这个[交] [1] [1]:http://stackoverflow.com/questions/4114956/prism-app-does-not-exit-when-closed/11987246 #11987246 – Adys 2012-08-16 13:06:20