/// <summary>
        /// Invoked immediately before the Page is unloaded and is no longer the current source of a parent Frame.
        /// </summary>
        /// <param name="e">
        /// Event data that can be examined by overriding code. The event data is representative
        /// of the navigation that will unload the current Page unless canceled. The
        /// navigation can potentially be canceled by setting Cancel.
        /// </param>
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (ScenarioDisableButton.IsEnabled)
            {
                if (null != displayController)
                {
                    displayController.Dispose(); // closes the controller
                    displayController = null;
                }
            }

            base.OnNavigatingFrom(e);
        }
Example #2
0
 private void DisableDisplayOnOffController()
 {
     if (_displayController != null)
     {
         _displayController.Dispose(); // closes the controller
         _displayController = null;
     }
 }
Example #3
0
 public void EnableDisplayAutoOff(bool _enabled)
 {
     if (_enabled)
     {
         if ((_sensor != null) && (_displayController == null))
         {
             _displayController = _sensor.CreateDisplayOnOffController();
         }
     }
     else
     {
         if (_displayController != null)
         {
             _displayController.Dispose();
             _displayController = null;
         }
     }
 }