Ok. I have used this in my app :
#region private members
bool runsUnderLock;
bool isRunningUnderLock;
bool hasUserAgreedToRunUnderLock;
bool isRestartRequired;
#endregion
#region public properties
public bool RunsUnderLock
{
get
{
return runsUnderLock;
}
set
{
if ( value != runsUnderLock )
{
runsUnderLock = value ;
if ( runsUnderLock )
{
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
PhoneApplicationFrame rootframe = App.Current.RootVisual as PhoneApplicationFrame ;
System.Diagnostics.Debug.Assert(rootframe != null, "This sample assumes RootVisual has been set");
if (rootframe != null)
{
rootframe.Obscured += new EventHandler<obscuredeventargs>(rootframe_Obscured);
rootframe.Unobscured += new EventHandler(rootframe_Unobscured);
}
}
else
{
IsRestartRequired = true;
EventHandler eh = RestartRequired;
if (eh != null)
eh(this, new EventArgs());
}
SaveSetting("RunsUnderLock", runsUnderLock);
OnPropertyChanged("RunsUnderLock");
}
}
}</obscuredeventargs>
You can read this :
Solution
Please rate if a helped you :)