mono/MonoGame — pull request #2286 by picobots (2014-03-18 23:24:40+00:00)
Title: Added additional iOS application events to Game class

## Overview ##

MonoGame already gives us access to these iOS app lifecycle events (through Game.Activated and Game.Deactivated):

- `applicationDidBecomeActive`
- `applicationWillResignActive`

But although MonoGame has callbacks for these additional iOS application events under the hood, there was previously no way to access them through the Game class:

- `applicationDidEnterBackground`
- `applicationWillEnterForeground`
- `applicationDidReceiveMemoryWarning`

This commit adds `EnterBackground`, `EnterForeground`, and `MemoryWarningReceived` events to the MonoGame Game class (conditionally compiled for IOS only).

I personally think it's good to be able to respond to these other events from XNA game code. For me, simply responding to Activated and Deactivated isn't ideal; my game saves constantly and aggressively, but I only occasionally want to upload my save data to the cloud (using iCloud on iOS). For me, applicationDidEnterBackground is the perfect time to do this, because it signals that the user is potentially quitting the game for a while (vs. simply deactivating the game, which might only last a second or two).

## Concerns ##

First of all, this is my first ever GitHub fork and commit, so I apologize if I screw this up. I hope I'm doing this right :)

Secondly, I noticed that some of the other custom Game event declarations use a `[CLSCompliant(false)]` attribute, for example:

```C#
#if WINDOWS_STOREAPP
[CLSCompliant(false)]
public event EventHandler ApplicationViewChanged;
#endif

#if WINRT
[CLSCompliant(false)]
public ApplicationExecutionState PreviousExecutionState { get; internal set; }
#endif
```

I'm not sure exactly what that attribute means. Should the event declarations I added for EnterBackground, EnterForeground, and MemoryWarningReceived also be decorated with the same attribute?