Windowsで認証されたユーザーがwpfアプリケーションの有効なユーザーであるかどうかを確認しています。
そうでない場合は、アプリケーションをシャットダウンする必要があります。ただし、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();
}
}