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.
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;
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Enabled;
You can download the demo file here : https://skydrive.live.com/redir?resid=29F099C37B76CA59!2752&authkey=!AOBimFuXpsh6oog
I was revisiting my old projects and reflecting on how I could improve on those products. I didn’t realised that there are so much we can do with the new Windows Phone APIs! I was looking at the MSDN’s Microsoft.Phone.Tasks Namespace and found out that there is a Bing Maps Direction Task Class now!
The first thing I thought of was the Green App project which I did during codeXtremeApps 2010 Its a Windows Phone 7 project where we direct our users to the nearest recyling bin around Singapore for them to recyle their waste product. There are more functions which I will not elaborate on here. I will be updating my project/portfolio page soon! I was playing with the Bing Maps Direction Task API just this afternoon. Thought it will be useful to post a tutorial on how to use it. 🙂 Should you face with any problems, feel free to contact me via the Contact Me form or email me at [email protected]
Step 1 : Adding using Microsoft.Phone.Tasks and using System.Device.Location into references.
Step 2 : Adding the Microsoft.Phone.Tasks and System.Device.Location into the project
Step 3 : Initialize a BingMapsDirectionsTask and create a start and end LabeledMapLocation . Note that start is optional. Should you not provide start location, the API will use the current location by default.
At the end of it, .Show() it and it will show the map.
BingMapsDirectionsTask Direction = new BingMapsDirectionsTask();
LabeledMapLocation start = new LabeledMapLocation(“Hougang Ave 4 919 Singapore , Singapore”, null);
LabeledMapLocation end = new LabeledMapLocation(“Paya Lebar Air Base, Singapore”, null);
Direction.Start = start;
Direction.End = end;
You can download a usage demostration of the class here. Source code included.
Please note that this is written for WP7.1
If you have any questions, feel free to contact me via the contact form, comment or email me at [email protected]
Do check out the tutorial page too!
Recently I blogged about Error reporting for Windows Phone 7 : Little Watson but when I was using it for the Slime Sweeper V2 , i realised its not as simple as copying and paste the framework over to XNA and use it. We have to introduce some extra stuffs.
We have to add Microsoft.Phone and System.Windows references into the project. The codes are similar but we do not have native MessageBox.Show and Application.Current.UnhandledException in the project like what we have on Silverlight project and hence we have to add them differently to the project.
In the constructor of the game, we have to add this code.
Application.Current.UnhandledException += (s, e) =>
// We do not want to throw exceptions in our exception handler
and as for MessageBox.Show, I am using Guide.BeginShowMessageBox method.
You can download the sample code which I have built here, the button will crash the application and when you try to go into the application again from the emulator, a messagebox will appear :
If you have any feedback or question, feel free to contact me via the contact me form or email me at [email protected]
Recently Chris Ismael, Developer Evangelist from Microsoft Singapore posted a blog post on Innovative Singapore on the resources which Microsoft kindly released to help the developer to learn WPDT 7.1 ( Known as Mango )
This blog post consolidate all the samples and walkthrough on how to use WPDT 7.1 http://innovativesingapore.com/2011/05/a-comprehensive-mango-developer-documentation-reference/