检查应用程序是否在Simulator上运行

Igo*_*gor 6 c# mobile microsoft-metro windows-8 windows-runtime

如何检查WinRT应用程序是否在模拟器内运行?

对于Windows Phone,我使用以下代码:

    Boolean isOnEmulator 
            = (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator);
Run Code Online (Sandbox Code Playgroud)

但我无法找到WinRT的解决方案.

Mau*_*hah 4

你可以尝试这样的事情:

bool isRemote = Windows.System.RemoteDesktop.InteractiveSession.IsRemote;
Run Code Online (Sandbox Code Playgroud)

如果它在模拟器上,它将返回 true,否则返回 false。