using System;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace WPDisableLockScreen
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            App.Current.Exit += new EventHandler(Current_Exit);

        }

        void Current_Exit(object sender, EventArgs e)
        {
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
        }
    }
}