如何知道wpf app是否在终端服务会话中?
有没有相当于
Wpf中的SystemInformation.TerminalServerSession ?
我想知道当前的wpf应用程序是否在终端服务器会话中运行。 谢谢
您可以使用SystemParameters类来查询系统设置,尤其是SystemParameters.IsRemoteSession属性,以获取一个值,该值指示调用进程是否与终端服务客户端会话(如SystemInformation.TerminalServerSession属性)相关联。
只需添加对System.Windows.Forms的引用因为您没有弄乱UI,所以您不需要任何特殊的东西。
System.Diagnostics.Debug.WriteLine(System.Windows.Forms.SystemInformation.TerminalServerSession.ToString());