blog.reis.se

It's all about looks

JayPokerI was trying out a few things on the windows phone 7 platform and wanted to come up with a simple application idea. There are numerous of simple list application examples out there like twitter and RSS readers but I wanted to try something different, something both useful and a bit more playful. And with a limited time.

So why not a planning poker application? Most of the graphics was already there like the coffee cup, infinity mark and the logo so it was simple to whip it together. But I still think there are a few interesting parts in this.

As it’s static data, there are no more than the numbers, coffee cup, question mark and the infinity sign.  I didn’t bother with any complicated view model, just went along with static buttons. And one big button as the currently selected card. I re-styled the button to make it look like a card and added the graphics and text. The big card is normally hidden but when I select a card it is populated with the selected cards content and the popped up.

The trick here is that if the selected card is an Image the I create a new image and assign it to the content and if its text I assign that directly to the content.

if (_currentCard.Content is Image)
  BigButton.Content = new Image
    {
      Source = ((Image)_currentCard.Content).Source, 
      Height = 234, 
      Width = 202
    };
else
  BigButton.Content = _currentCard.Content;

Next up is the animation. I wanted the card to flip over while I tuned up the dark overlay. The basic animation was easy to set, I just used a combination of scale and plane transforms to get the big card from the small size and up to the full screen view with a flip. It was a bit trickier to get the card to start and end the animation on the right spot. A little calculation together with naming of the places where I should modify the animation, with  an “x:Name” property, did the trick. Now I was able to modify it from code using the following to set the position:

int xValue = -180 + 120 * 
    int.Parse(_currentCard.GetValue(Grid.ColumnProperty)
     .ToString());
int yValue = -260 + 190 * 
    (int.Parse(_currentCard.GetValue(Grid.RowProperty)
     .ToString()) - 1);

((EasingDoubleKeyFrame)FindName("startX")).Value = xValue;
((SplineDoubleKeyFrame)FindName("endX")).Value = xValue;
((EasingDoubleKeyFrame)FindName("startY")).Value = yValue;
((SplineDoubleKeyFrame)FindName("endY")).Value = yValue;

It's not the most elegant code, with no safeguards when I cast between stuff, but I whipped it together during an afternoon and it was rewarding to see what could be accomplished with some 50 lines of code and a little blend. And who knows I might clean it up and publish it as soon as the devices are out and the market place is up.

Time to plan the next sprint // Håkan Reis


Microsoft MIX10 brain dump

Also cross-posted on my company blog

After three days of the Microsoft Mix10 event the brain tend to overflow. So I sit down at a Starbucks and try to summarize my thoughts before my mind explodes.

It’s easy to get caught up in positive buzz during events like this but I really think Microsoft is doing a lot of things right here with Windows Phone 7 series, the next level of .NET and Silverlight and Internet Explorer 9, among other things. Some of it, I believe, accounts to all the focus on User Experience and the influence that Bill Buxton have on this.

Also if you want to catch any of the sessions most of them are up at the mix10 site already.

Silverlight release pace

This was a big surprise to me; Silverlight 4 is going to be released as early as next month end the release candidate (RC) is out now. I was more in the lines of a beta and the an RC in the summer and a release late 2010. But it seems they try to align and do a big release with .NET 4, VS2010 and Silverlight 4. As a bonus the Pivot control will be in the controls toolkit so that’s going to be fun to play with.

Silverlight 4 Tools RC | .NET 4 RC | VS2010 RC

About the Windows Phone 7 series

The development platform for Windows Phone 7 series was, of course, one of the biggest news on the starting keynote and lot of sessions around it followed. I think they are on the right track with the platform. A few surprises surfaced, like the inclusion of DirectX to utilize HW backed video decoding and the Windows Phone development tools being released for free.

But a few questions and problems surfaced as well, as you can se all over the web it seems they are not including cut & paste and market place being the only application deployment channel. Other things I thought about was:

  • How is the user interface is going to perform in right to left markets.
  • What the possibilities are to hook in other services, like for example Pandora, to provide music streams for the native Zune player.
  • And I still have a few issues with lag in the interface as well as accidental clicks, lets just hope the will get this issues out the door before they release it.

The user experience work that has been put into the new OS is really cool, the decision to remove all chrome and go for a real clean and consistent look is really fresh. And the decision to let the back button work on all levels across the phone, in-applications as well as between was a stroke of genius.

Windows Phone Dev tools | UI Design guidelines

What about HTML 5 and IE 9

It was pretty obvious that they should release some news around Internet Explorer 9 and its take on HTML 5. It is just an early technology preview but I have to say I’m impressed by the results. They did tone down the JavaScript speed issues but quite frankly they were on par with the other browsers and at those speeds it really is less of an issue. What still is an issue is standards, and anything but a 100/100 score on Acid3 is a failure in my eyes.

What they did show was the brilliant work they have done on the GPU acceleration part. This really was amazing 720p HD video streaming on a netbook was blazing fast, they even manage to pump two 720p streams without a glitch, impressive. And rendering HMTL5, CSS3 and SVG with hardware acceleration really looks promising.

If anything it shows that the Internet Explorer team is still in the game and might really get a decent browser out the door.

IE9 platform preview

Expression Blend 4

The things I saw done with blend was quite cool, this tool has come a long way from the first release and is now a potent tool. The tight integration with Adobe was finally in place, just point to the assets and start editing it in Illustrator or Photoshop. What’s more impressive, if I got it right, was that you were able to bind to a text object from the imported Illustrator assets directly to the object in your ViewModel! This really puts design control back into the hands of the designer.

Expression Blend 4 beta

Get real

So what’s left for me now is to find the time to play with all these new toys and and experience for myself what they are capable of before it’s time to Get Real and start creating.

Have fun // Håkan Reis


Time for Mix10

See You Just backing up the last stuff on my computer before shutting down. Checking the flight plan once more and packing the last items. Tomorrow I’ll get up early to catch a plane to Las Vegas and Mix10. This is really going to be fun. Especially I look forward to the HaaHa show, the key note, and of course the stuff on Windows Phone 7 Series (still a really bad name).

Of course its not that bad that its in Las Vegas, but well that’s just a bonus. You could of course expect some kind of report here from my visit when I had some time to digest the impressions.

See you // Håkan Reis


libraries Ever since Microsoft first introduced the “My” in every folder I have hated it. I know it’s my documents and my music, hell I paid for most of the music anyway and created the documents myself. So why do they continue this, even win Win7? If you look at the real name in the folder structure it is actually C:\Users\[username]\Documents not C:\Users\[username]\My Documents?

I know it can make some sense when you compare My Documents and Public Documents but I don’t like it that way, especially since the real folder name is in fact Document.

So I started to look into it and experimenting, searching through registry values and stuff with no luck. Searching the web also came up empty handed (just a lot of references to how you change the default My Documents folder, etc).

But actually it was much simpler that I expected, I just selected the damn thing and changed the name in properties. Renamed it to Documents and now it really make sense again. So I can have some peace.

// Håkan Reis


I have said it before and I will continue to push my theory that the next big problem area will be in configurations. The environment variables are an old habit, used extensively by the java framework but it also makes ripples in the Microsoft build environment.

donkeyI just spent some time introducing TeamCity continuous integration and build system to a company. It’s an excellent product from JetBrains that I can truly recommend. Comparing Cruise Control with TeamCity is like comparing notepad with Visual Studio. All can be done but not without inflicting pain.

Normally, setting up a new project build and test is a child’s play in TeamCity, but not this time. Apart from a few hurdles regarding subversion access and some cumbersome handling of references in the solutions there was a more evil and nasty problem.

At each build we were getting a MSB4126: “Release|BWS” configuration invalid. I searched sifted through tons of config files, project and solutions with no luck. Finally I fond the problem, it was in the environment variable Platform. For some reason this variable was set to BWS. I still have no explanation on to what BWS means (other than Beer Whine and Spirituous) and why it was set. I removed it and the system runs without a problem. After that little fix the builds executed like a charm.

The root of this problem is actually that MSBuild tries to be smart, looking at the Platform environment variable and adding what’s in it to the build. But why should it try this, what other configuration sources should I be aware of that can inflict strange behavior on my set-up? And in the name of flexibility and choice we add to this mess of configuration, every part of the system should be configurable, its always in one of the constricts of every project to day. Never hard code, always provide flexibility.

The problem is that leads paralysis as in Paradox of choice, and the way out of this is to step back, look around and start setting up some boundaries for choice. That we offer flexibility with a great sense of responsibility, and stick to a well established default behavior.


For quite a while I had a problem with setup builds. As soon as I was building I was getting errors like:

Could not create the file '<file>.tmp' 'Access is denied.'

It was driving me nuts and I had a hard time finding the solution. Finally I got a tip about KB Q329214 from a friend and in here I found the solution.

It was the Mergemod.dll that wasn't correctly registered that was the root cause. So the following had to be done at command prompt (with admin rights of course), the (x86) is there as I'm running Vista64:

regsvr32 "C:\Program Files (x86)\Common Files\Microsoft Shared\MSI Tools\mergemod.dll"

So now I have updated to SP1 and again I ran in to the same problem. This time I remembered that there was a solution so finding it was a bit easier, but if had written this post right away it would have been no issue to solve this. Mental note: Always blog about these fixes.


I always work close to the UI. Actually, most of the time elbow deep in the GUI. But I also love testing. One thing you don't want to do, is drive you GUI for unit testing purpose (there are other uses for that but not unit testing...trust me on that). So it would be great to fire events at will, or in the test code but that's not an option either. To much trouble.

Another way is to just open up the event handlers to the public and execute the code and that, in a testing sense feels a lot better. But again, event handlers is not a good thing to open up to the public, especially when you are building libraries.

I remember Marcus Widerbeg and I had a few discussions around this, how to maintain testability but retain protection. I think the following can develop further but It will do for most scenarios.

There are an attribute that actually seems to be made for this scenario. InternalsVisibleTo... This will present internal methods and fields to a specific strong named and signed assembly, that should be the unit test assembly. It's quite simple. Just change the protection from private to internal. Sign your test assembly and set the attribute in the AssemblyInfo.cs, together with the public key for your test assembly, like this:

[assembly: InternalsVisibleTo("Haqwin.Gui.UnitTests, PublicKey=00...cb")]

To find the public key, just build your solution and run the sn.exe tool like this:

sn -Tp Haqwin.Gui.UnitTests.dll

So now I can use this to unit test most of my UI code as well as automate the Function and Integration tests. Driving them almost as close as executing the actual interface.  Here is an example of testing the EventHandler for a button:

[Test]

internal void NavigateMetaDataEditor()

{

    Assert.AreEqual(DockStyle.Fill, _InitializeMetaData.Dock);

    Assert.AreEqual(DockStyle.None, _EditMetaDataControl.Dock);

    _InitializeMetaData.NextControl = _EditMetaDataControl;

    _InitializeMetaData.NextControlButton_Click(this, new EventArgs());

    Assert.AreEqual(DockStyle.None, _InitializeMetaData.Dock);

    Assert.AreEqual(DockStyle.Fill, _EditMetaDataControl.Dock);

}

The other solution to this problem, is to use reflection to get to the private methods but I'll save that for another post