Check platform on Windows 10 Universal App

青春壹個敷衍的年華 提交于 2019-12-06 07:21:45

VersionInfo | versionInfo property should helps to check the platform information.

    var str = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
    if (str == "Windows.Desktop")
    {
      //...
    }
    else if (str == "Windows.Mobile")
    {
      //...
    }

Yes, you can use the compiler directives

#if WINDOWS_PHONE 
//some code
#endif

#if WINDOWS 
//some code
#endif
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!