[SOLVED] Device-exclusive code

I’m working on a little project using that hybrid Windows Phone 8/Windows 8 Store template. At one point, I have the game show the cursor onscreen, so I can play it on the PC, but if I try to deploy to the phone, VS yells at me, giving out a generic “NotImplementedException”. How can I tell it to ignore this line on the phone?
I believe this might not exactly be a Mono related issue, but I’m having a hard time finding out.

I think it throws that because no mouse is attached…

Would help if you can screengrab the exact throw…

In the solution explorer right click on the Windows Phone 8 project and open Properties. Go to ‘Build’ tab.
Then inside ‘Conditional compilation symbols’ add “WINDOWS_PHONE8_1” (or whatever…, probably the templates already define something similar for each project/platform, I don’t remember what those are).

in your game class use this code to set the mouse.

    this.IsMouseVisible = true;

Thanks a lot! This is exactly what I was looking for.

1 Like