Saw a question on Dream Build Launch on how can one use toggle control to disable / enable idle detection and from there, enable/disable it idle detection accordingly.
I believe he needed it in his setting page. Did up a quick demo.
Resources
1. I used the toggle control from the silverlight toolkit for Windows Phone on codeplex (Can be found here : http://silverlight.codeplex.com/releases/view/75888) for the toggle control.
2. Do read this msdn article for
Things I did
1. Added the toggle controls in the toolkit into Visual Studio (if you have yet to do so)
2. Pull in the toggle controls and attached the checked event handler onto the control.
3. Add the following code (I included the method signature here).
private void toggleSwitch1_Checked(object sender, RoutedEventArgs e)
{if (toggleSwitch1.IsChecked == true)
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
else
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Enabled;
}
You can download the demo file here : https://skydrive.live.com/redir?resid=29F099C37B76CA59!2752&authkey=!AOBimFuXpsh6oog