1st Wedding Anniversary

April 20, 2010

Today is our 1st Wedding Anniversary. Me, my wife and my sister went to New York New York! and had very great dinner… The following are some of our photos that we took in that shop.. It was great and fun.. :) You can also check my wedding photo in this link .

SG Silverlighters, we got 3rd meetup

April 12, 2010

Hello Singapore Silverlight Developers,

We are gonna have “Singapore Silverlight User Group” 3rd meetup on April 22. Chris Ismael from Microsoft Singapore will talk about Silverlight for Windows Phone 7. Game Development and Mobile Application Development are very popular in Singapore. So, I believe that Chris’s section will be very interesting for you guys. Please come. See you there..

Date: 22nd April, 2010
Time: 7 PM – 10 PM
Location: Hackerspace

Agenda :

  • Anatomy of a WP7 app (from a Developer/Designer’s perspective) by Chris Ismael
  • WP7 and the impact to SL Developers (Discussion)

Special thanks to Chris, Justin Lee, Dewi and Alex.

Silverlight MVP Award 2010

April 12, 2010

Today, I have received MVP Award Kit from Microsoft today. I’m very happy about that. I like to say thank you so much to Microsoft, Lilian, Windy, Justin Angle, Justin Lee, Alex, Chris and everyone who are in Silverlight community.

1. MVP Award Kit – Fed Ex

2. MVP Award – Card

3. MVP Award

4. Silverlight MVP Awards 2009 and 2010

Related ~

Tip: “Object reference not set to an instance of an object” Error in Silverlight for Windows Phone 7

April 9, 2010

Problem :  ”Object reference not set to an instance of an object.”  messagebox will be displayed when you are running Silverlight Windows Phone 7 Application in Visual Studio 2010.

Solution : Shawn Oster, Program Manager of Silverlight for Window Phone team, confirmed that this is a known issue that they are currently working on fixing for next update. The workaround for this issue is that you need to ensure that the solution is not highlighted in Solution Explorer.

Let’s take a look at the picture below. Solution “WP7ApplicationBar” is highlighted in Solution Explorer, right? That’s why you are getting this error.

In order to fix this, you need to move the selection by clicking on Project Name or other files in Solution Explorer. As you can see, Solution “WP7ApplicationBar” is highlighted in previous screenshot. And we moved the highlight to ProjectName in second screenshot. Then, you can try to run the application from Visual Studio again. I think it will work this time.

Hope you find it useful. I’m facing this problem quite so often lately. This funny trick helped me to solve this problem. :) If this trick doesn’t help you then please feel free to let me know.

Test-Driven Development in Windows Phone7 – Part 1: Unit Testing with Silverlight for Phone7

April 8, 2010

This is the first post of “Test-Driven Development in Windows Phone7″ series. I will show you how to use Silverlight Unit Test Framework for Windows Phone 7 and how to run the unit tests in Phone emulator. As it’s an introductory post, I will not talk about TDD or stub or mock in this article. (But I promise those things will come in next post. )

Download ~

Prerequisites

Creating Window Phone Application and Unit Test project

First of all, we will create a “Windows Phone Application” (I will call it “AddressBook” ) in Visual Studio 2010. “Silverlight for Windows Phone” supports only C# language so you need to find “Windows Phone Application” project under “Visual C#” node. If you are an VB developer, I’ve to say sorry for you. C# and VB.NET used to be under same boat but I’m not sure what makes Windows Phone team to decide to left all VB.NET developer. Anyway, there are numbers of VB.NET to C# converter on the net so it’s not so difficult for you to find out the similar C# keywords.

Next, we will create another “Windows Phone Application” for unit test under same solution. As the time of writing, there is no “Silverlight Unit Test” project template available to download. But I’m sure that Jeff Wilcox is working very hard to get that template for us. According to his new blog http://jeffatmix.com/, we will probably get Silverlight Toolkit with Unit Test Framework on this April. You can’t use “Class Library” project template too.

Okay. Let’s create “Windows Phone Application” and I will call it “AddressBook.Tests”.

Finally, we got two projects in our solution as below.  One is for our application and another one is for unit tests. So far so good, right?

Converting Windows Phone Application to Unit Test Project

As this is not a unit test project template, we  will have to do a few manual steps to make AddressBook.Tests prject as a unit test project.

First, we will remove RootVisual Xaml tag from App.xaml.

And then, we will delete MainPage.xaml file from unit test project. Silverlight Unit Test Framework already has a TestPage so we don’t need Mainpage.xaml anymore.

Now, we need to download the Test Framework from Jeff’s MIX website. http://jeffatmix.com/

Please create a folder (I will call it “LIB” ) in your project directory and extract the zip file and place two assemblies in that folder.

  • Microsoft.Silverlight.Testing.dll
  • Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll

After that, we will add those assemblies in our unit test project “AddressBook.Tests”.

We removed the RootVisual from App.xaml file earlier. Silverlight can’t run without having RootVisual set so we will have set Unit Test page to the Application RootVisual in App.xaml.cs.

Then, we need to set our Unit Test Project as a startup project in Solution Explorer.


Creating Tests

We have converted Silverlight Phone Application into Unit Test project and configured all required things in that project. So, it’s time to write a test. As we are very new to this Unit Test framework and we haven’t used any test framework on Phone 7 emulator, we will create a very simple test class (I will call it “SimpleTest”) just to see how it works on emulator.

We need to add an attribute called TestClass attribute in our test class “SimpleTest”. We will also create a test called “AlwaysPass” with TestMethod attribute in that class.

[TestClass]
public class SampleTest {
[TestMethod]
public void AlwaysPass() {
Assert.IsTrue(true);
}
}

And then, let’s build the application and run it. If you are running Phone emulator for the first time, it will take a few mins to get loaded. The following is the first screen that you will see..  Don’t be alert that those are not the tests that you wrote. I think it might be a bug in Test framework. I need to ask Jeff about that and will update my post based on his reply.  Just be cool and wait for a few minutes more.

Then, you will see the Test that you wrote on Phone emulator. The list of Test classes under your project will be shown in first page. You can go into each class to see all test methods by clicking on the name of class.

You will see “your code look good” in status since all tests are passed. You can also see the total number of tests, how many tests are passed and how many are failed in the right side of status bar.

Let’s add another test method called “AlwaysFail” in our SimpleTest class. So, our test class will be as below ~

  [TestClass]
    public class SampleTest {
        [TestMethod]
        public void AlwaysPass() {
            Assert.IsTrue(true);
        }

        [TestMethod]
        public void AlwaysFail() {
            Assert.IsTrue(false);
        }
    }

Let’s run the project again and see how it looks like if we have a failed test.

The Test class that has some failed tests will be displayed in Red color. You will see how many tests are not passed in status bar as well.

That’s all. It’s just an introduction of how to use Unit Test framework in Window Phone 7. We will implement Addressbook Application with TDD in next post. Feel free to let me know if you have any comment or suggestion.

Happy Silverlighting!!

Step by Step Tutorial : Installing Multi-Touch Simulator for Silverlight Phone 7

April 6, 2010

First of all, I would like to say thank you to Davide Zordan, Stefan Wick, Jonas Follesø and Laurent Bugnion for helping me to get this post out. It took me quite a few days since I was facing a lot of problems.  Now, it’s working in my machine and I like to share this with you all.

This post is written for those who don’t have touch device but want to develop multi-touch Silverlight application for Windows Phone 7. If you prefer to watch the screen-cast created by the original developer of Multi-touch Vista, you can watch it here. But as there is no audio and the way that he presented is a bit fast for the most of viewers, I decided to write the step-by-step tutorial based on his screen-cast. I give the full credit to the original developer of Multi-touch Vista. He has done very good job.

1. Software

You will need the software below before you start playing with Silverlight for Phone 7.

2. Download Multi-Touch Vista

Once you have installed the required software above, you need to download Multi-touch Vista from codeplex. We will be using Multi-touch Vista as a multi-touch simulator in this article. There are a lot of things that Multi-touch Vista can do but we will use it as a touch simulator only. The following is what the author of Multi-touch Vista wrote about his project. I’m just doing copy-paste the description here just in case you are interested to read. :)

Multi-Touch Vista is a user input management layer that handles input from various devices (touchlib, multiple mice, TUIO etc.) and normalises it against the scale and rotation of the target window. Now with multitouch driver for Windows 7.

2. Installing the driver

  • Extract the zip file
  • Open the Command line with administrator right (Note: This is very important step. Otherwise, you will get this error “devcon failed.” )
  • Go to the folder that you have extracted the file
  • Go to Driver folder
  • Go to x64 or 32 based on your system configuration (In my case, I’m using 64 bits computer so I will go to x64 folder. )
  • Then, you will see one bat file called Install driver.cmd
  • Type “Install driver.cmd” and press Enter key as shown in picture.

  • You will get the dialog below asking whether you want to install this device software or not. Please click on “Install” button

  • If the installation is completed, you will see the message as below in command line. Then, you can close that cmd now.

3. Device Manager

  • Now, it’s time to open the device manager. You can open the device manager from control panel but I will do with short-cut way.
  • Type “device manager” without double quote in Window Search Bar and hit Enter Key

  • Now you will see the Device Manager as below. Go to “Human Interface Devices”

  • Right-click on “Universal Software HID device”
  • And choose “Disable” to disable the device

  • You will get the confirmation before disabling the device.
  • Just say “Yes”

  • After that, re-enable this device again.
  • Right-click again on this node and choose “Enable”

4. Pen and Touch

  • Please type “pen and touch” without double quotes in Windows Search Bar. (Note: If you have managed to complete the step #3 property, you should be able to open “pen and touch” dialog. If you don’t get any dialog then please go thru the step #3 again. )

  • You will get the “Pen and Touch” dialog as below. Go to “Touch” tab and tick on “Show the touch pointer when I’m interacting with itmes on the screen.”

5. Creating Silverlight Phone Application

  • OR you can download my sample that I created from this link.

Once you have downloaded the sample, please open it in VS 2010 and build it. Please ensure that you are able to compile it successfully. After that, we need to run the Multi-touch Vista to simulate the touch input for our application.

6. Running Multi-touch Simulator

  • Connect another mouse device in USB port.
  • Run Multitouch.Service.Console.exe

  • One console window will be opened as below. And you will see two touch pointers

  • Run Multitouch.Driver.Console.exe (You will get another console window. )
  • Run Multitouch.Configuration.WPF.exe
  • Click on “Configure” to block the cursor

The system cursor is no longer available after that. But as you already have two mouse devices, you can move those “red” touch pointers by using your mouse. Each “red” touch pointer represents each USB mouse that you connected to your computer.

Let’s open Microsoft Paint and draw two lines simultaneously by using two mice. Here is what I have done. (My wife gave me weird look when I’m using two mice in one computer. :) ) Please try yourself and have fun.

  • Okay. Let’s go back to Visual Studio that we opened it earlier
  • Run it (it will take a while to load the emulator. You will see the screen below once it’s loaded. )

  • Move one “red” touch pointers on blue rectangle
  • Press it and move it around. You should be able to move that rectangle with your mouse.
  • Move two “red” touch pointers on blue rectangle
  • Press both left buttons of both mice. Drag one up and another one down slowly.  (You will see that the rectangle will be a bit longer as below. )

Note that the scaling is not really smooth right now. I will have to work on that. But I’m glad that I’m able to test it with multi-touch simulator without buying real touch device. Anyway, if you can afford to get a real touch device, I would recommend you to get it.

Happy Silverlighting!! :)

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org