我正在检查Windows认证用户是否是我的WPF应用程序的有效用户。
如果不是,我需要关闭该应用程序;但即使执行了Application.Current.Shutdown(-1),该应用程序仍然会继续运行。
下面的链接说我需要删除我的StartUpURI;但我在我的app.xaml中没有这个标签。-> 从App.xaml.cs关闭WPF应用程序 编辑:我在APP.XAML.CS中有这段代码。
如果不是,我需要关闭该应用程序;但即使执行了Application.Current.Shutdown(-1),该应用程序仍然会继续运行。
下面的链接说我需要删除我的StartUpURI;但我在我的app.xaml中没有这个标签。-> 从App.xaml.cs关闭WPF应用程序 编辑:我在APP.XAML.CS中有这段代码。
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
this.exceptionPolicy = ConfigurationManager.AppSettings.Get("ExceptionPolicy");
this.displayErrorDetails = true;
this.container = new UnityContainer();
// Register services and types in Unity
RegisterServices();
// Check user
if (!IsValidUser())
{
//Application.Current.Shutdown();
App.Current.Shutdown();
}
}
Application.Current.Shutdown()
周围的代码。问题可能与你从哪里调用它有关。 - Joel B Fant