Check platform on Windows 10 Universal App

元气小坏坏 提交于 2019-12-07 22:58:25

问题


How can I check which platform (Windows / Windows Phone) my app is running?


回答1:


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")
    {
      //...
    }



回答2:


Yes, you can use the compiler directives

#if WINDOWS_PHONE 
//some code
#endif

#if WINDOWS 
//some code
#endif


来源:https://stackoverflow.com/questions/32404755/check-platform-on-windows-10-universal-app

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