Windows Phone Phone Calls
/It will come as no surprise to you that your Windows Phone programs are interrupted when the phone rings. However, if you are running an XNA game at the time it will not actually stop. This will probably annoy your game player though, as once they come back from explaining that they don’t want any double glazing just right now they will probably find that all their lives have been lost and the game is over.
To get around this you should make your XNA game drop into pause mode when a call comes in. You can get notification of things like phone calls by binding to the Activated and Deactivated events.
this.Activated +=
new EventHandler<EventArgs>(Game1_Activated);
this.Deactivated +=
new EventHandler<EventArgs>(Game1_Deactivated);
You can get Visual Studio 2010 to do all the hard work here, just type “this.Activated +=” and then press Tab in response to the magic that happens next. Then put code into the methods that are generated and away you go.
Note: This is not what happens if the player presses Windows or Back. In those cases your game program is stopped. But that is a subject for another post I think.