tutorial
BingMapsDirectionsTask – Getting driving / walking directions
2I 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 guohong@limguohong.com
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;Direction.Show();
You can download a usage demostration of the class here. Source code included.
Please note that this is written for WP7.1
P.S: These 2 classes caught my attention, when I have some spare time, I will look into if I will be able to use it in my Slime Sweeper 2! ShareLinkTask class and Share Status Task Class!
If you have any questions, feel free to contact me via the contact form, comment or email me at guohong@limguohong.com
Do check out the tutorial page too!
WCF Completed Event firing more than once
0The problem situation is stated in the title. =P
The “fix” to the problem is something real simple. I didn’t notice it when it happened to me the first time. This post is also posted to remind myself about it.
This is an example of a code with the problem.
public class WorkingArea{
Server.ServiceClient client = new Server.ServiceClient();public WorkingArea()
{
InitializeComponent();
}private void btnCheck_Click(object sender, RoutedEventArgs e)
{
client.CheckCompleted += new EventHandler(Client_UpdateCompleted);
client.CheckAsync(Value);
}
}
This code seems to be working fine. I have a Service which I declare it as client and everytime I click on the button Check, i attach the event handler and call the async method to run it. But wait, what went wrong is this.
“…..everytime I click on the button Check, i attach the event handler and call…….”
What happen is there will be alot handlers being attached to the client variable as times go by ( with the user clicking the button in our example ). The callback/comepleted event will increasingly happen with the button click in this example. With abit of moving of that line where you attach the handler. This will solve the problem.
“client.CheckCompleted += new EventHandler(Client_UpdateCompleted);”
I will recommend putting this in the constructor, loaded event handler or onNaviagtedTo. This will depends on what is the architecture of the application you are building.
If you have any question, please feel free to contact me at guohong@limguohong.com or use the contact page. Please visit the tutorials page for more tutorials from Microsoft Office to Windows Phone!
Microsoft Powerpoint 2010 – Inserting Offline Video
0One of the good things in Microsoft Powerpoint 2010 is the ability to insert offline and online videos into your powerpoint presentation easily. Do look at this if you are wondering how to achieve it.
One of the common questions are what are the different format available,
Note Videos in the .mp4, .mov, and .qt formats can be played in PowerPoint
if the Apple QuickTime player is installed.
File format Extension More information Adobe Flash Media .swf Flash Video This file format is generally used to deliver video over the Internet using the Adobe Flash Player. Windows Media file .asf Advanced Streaming Format This file format stores synchronized multimedia data and can be used to stream audio and video content, images, and script commands over a network. Windows Video file .avi Audio Video Interleave This is a multimedia file format for storing sound and moving pictures in Microsoft Resource Interchange File Format (RIFF) format. It is one of the most common formats because audio or video content that is compressed with a wide variety of codecs (codec: An abbreviation for compressor/decompressor. Software or hardware used to compress and decompress digital media.) can be stored in an .avi file. Movie file .mpg or .mpeg Moving Picture Experts Group This is an evolving set of standards for video and audio compression developed by the Moving Picture Experts Group. This file format was designed specifically for use with Video-CD and CD-i media. Windows Media Video file .wmv Windows Media Video This file format compresses audio and video by using the Windows Media Video codec (codec: An abbreviation for compressor/decompressor. Software or hardware used to compress and decompress digital media.), a tightly compressed format that requires a minimal amount of storage space on your computer’s hard disk. Note The third-party products discussed in this article are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding the performance or reliability of
these products.
Microsoft Powerpoint 2010 – Compress Media
0One of the issues which people faced is that the powerpoint slides which they constructed is too big and cannot be sent via email.
I have screencasted a demonstration on how we can use the Compress Media feature to compress the media. Notice that i cut down the amount of disk space i need. From 37.7MB to 9.17MB.
You can download the sample here.
http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Office%20Demo/Compress%20Media%20Demonstration.pptx
For more information, please feel free to email me at guohong@limguohong.com or use the Contact Me form to contact me.
Microsoft Office 2010 – Removing picture background
0I have made a screencast to show how do we use the background removal feature in Microsoft Office 2010. This is one of the more common questions which teachers asked me when we were presenting at Yishun Town Secondary School
If you want to give it a try, you can download the sample files from here
http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Office%20Demo/Remove%20Background%20Sample.zip
Should you have any question, please feel free to contact me at guohong@limguohong.com
Microsoft Excel 2010 – Combining 2 charts into one ( Using same data source )
0I have made a screencast to show how we can combine 2 chart types into one chart when we are using the same data source. This is one of the questions posed to me when we were at Yishun Town Secondary School.
Microsoft Excel 2010 – Combing 2 charts into one ( Using same data source )
If you are looking for different data source, please look here
http://blogs.office.com/b/microsoft-excel/archive/2007/08/24/combining-chart-types-adding-a-second-axis.aspx
You can download the sample file here :
http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Office%20Demo/Double%20Chart%20Sample.xlsx
Should you have any question, please feel free to contact me at guohong@limguohong.com
Microsoft Excel 2010 – Protecting selected cells
3I was at Yishun Town Secondary School the other day to assist on the Gerald, Microsoft School Technology Innovation Center Manager, presentation on a hands on session for Microsoft Office techology.
We were posed some questions, I realised that it is useful to post some of them in a form of guide here so it will help teachers. How do we protect some cells and not allow editing on them while allowing some others to be edited. It will be useful when ICT HODs or teachers want to do up an excel document with the formulas and wish to send to his/her team to use but they do not want them to mess it up.

1. First, lets open up Microsoft Excel 2010.

2. In this example, we will add first and second column and show the result in the third column.
Select A3, go to Formulas tab > AutoSum > Sum

3. Select A1 and A2 for your data range.

4. On the bottom right of the cell, you will see a enlarged black dot, click on it and drag it all the way down to 20th row. ( In this example, we will just make use of 20 rows for the calculation. )

5. You will see something like this.

6. Right click on the 20 cells and go to Format Cells

7. Go to Protection and make sure Locked is ticked. This means these cells are not allowed to be edited.

9. Right click on the selected cells and go to Format Cells

10. Go to the Protection Tab and untick Locked ( This means these cells can be edited )

11. You might want to color the cells so that your end user will know that these cells can be edited by going to Home tab > Cell Styles > choose Input.

12. Go to Review tab > Protect Sheet

13. Input a password into the dialog box which appears. Please remember the password as you require that to unlock.

14. Another dialog box will appear to confirm the password, input the same password in again.

15. Try inputing values in A1-B20 and you will realised that you can do it but you cant do it when you try on other cells.
This concludes the tutorial on how do you protect selected cells in Microsoft Excel 2010. I have attached the sample document which you can download and have a look.
Should you have any question, please feel free to contact me at guohong@limguohong.com
Creating your first game on Popfly
0Microsoft Popfly (internally codenamed Springfield) is a website that allows users to create web pages, program snippets, and mashups using the Microsoft Silverlight rich internet applications runtime and the set of online tools provided. Popfly is currently in Beta stage of development. It requires users to log in with their Windows Live ID, and provide additional information about themselves when logging in for the first time to use Popfly.
Quoted from http://en.wikipedia.org/wiki/Microsoft_Popfly
http://www.popfly.com | I will be giving a tutorial on how to create a game on popfly. I personally think making a game on popfly all boils down to 3 simple general steps.
1. Ideas
2. Creating the game
3. Tweak the game to make it better
I will be teaching mainly the second stage, the creation of the game. I will pull in some simple functions which most people will be using when they are creating a game on popfly. Without further ado, we will start the fun!





