Determine if the project is compiled for windows 8 or wp

I have an application for a Windows phone, and I'm trying to port it to Windows 8. The problem is that several classes should be distributed for these projects. But some features from a Windows phone do not work on windows 8 and vice versa. Therefore, I probably should use preprocessor derectives to detect the OS. Are there already defined preprocessor constants that could help me with this? Or could you suggest a better way to do this?

PS These classes use async ctp library. And also some of them have network capabilities. And since downloading files in wp and win8 is different (I need asynchronous downloading of files with custom headers and POST requests), I also have to take this into account.

+4
source share
1 answer

Your best bet is to put all the common code in the Portable Library . This will allow you to target multiple platforms.

I think that there is no preprocessor directive for Windows 8, but you can easily create a new one in the assembly configuration (symbols for compiling properties / conditions).

+4
source

Source: https://habr.com/ru/post/1436062/


All Articles