private void DisableDisplayOnOffController() { if (_displayController != null) { _displayController.Dispose(); // closes the controller _displayController = null; } }
private void EnableDisplayOnOffController() { if (_sensor != null && _displayController == null) { // Acquires the display on/off controller for this proximity sensor. // This tells the system to use the sensor's IsDetected state to // turn the screen on or off. If the display does not support this // feature, this code will do nothing. _displayController = _sensor.CreateDisplayOnOffController(); } }