Author Archives: programabilan

Keep controls centered on resizable form

When dealing with resizable forms, managing layout can be achieved via the Anchor and Dock properties or using a layout panel. However, sometimes the design requires that certain controls stay centered, regardless of the parent form’s size. Luckily, a simple solution exists that does not involve writing centering code and handling resizing events. Read the rest of this entry


Error using the most recent version of RestSharp in wp7.

When adding RestSharp via NuGet to WP7 project, you will probably receive the following error:

File or assembly name ‘Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30AD4FE6B2A6AEED’, or one of its dependencies, was not found.

Read the rest of this entry

HTML5 canvas full view

I just wanted to share this small code sample for embedding HTML5 canvas fully inside the browser window. The simplest HTML looks like this:

        <canvas id="myCanvas" style="">

Read the rest of this entry

Uniform resizing of multiple containers in Windows Forms

When dealing with resizable dialogs, anchoring is the best way to ensure that certain controls, like containers or data grids, stretch and resize along with with the form itself. This ensures that the user experience is enhanced when dealing with large quantities of data that are, by default designed, viewed on small window. While this design is sufficient for certain cases, in other, more business like, there are limitations that can be overcome by using different container. Read the rest of this entry

Google Data API with RestSharp on WP7 Update

Special thanks to John Sheenan who pointed out an error in my code. First of all, calling Dispatcher.BeginInvoke is redundant since the callback action will be invoked on the main thread.

Secondly, there is a powerful deserialization feature in RestSharp. Create a simple class that will correspond to the deserialized JSON object: Read the rest of this entry

Google Data API with RestSharp on WP7

RestSharp is an open source REST client for .NET. I will use it for consuming Google Data API. You can easily install via the following NuGet command

Install-Package RestSharp

First step is creating an application in API Console and selecting services that you will be using. In this example, we will use the Tasks API. Once you create your project with the appropriate settings, you will need client_id and client_secret which is available on the API Access page. Read the rest of this entry

Google data API and OAuth: “invalid_grant” error

This extremely frustrating error can be remedied by simply re-requesting device code. You will need to authorize your app again, but at least it will work. You can also try changing the secret first, but in my case it did not work.

Visual Studio Achievements

Spawned from a popular blog post, this new add-in for Visual Studio brings gamification to everday work job to serve as a relaxing distraction from mundane code crunching. Even though most of the originally proposed achievements were cynical comment on the fact that there is so much bad code written today, and in that sense you do not want to achieve those “anti-achievements”, the actual list contains fun facts about the projects you happen to load inside your Visual Studio.

There is an excellent post at Ars Technica, check it out. The VS is portrayed as an expensive game in its Ultimate edition, comparing builds with spells and portraying compiler and linker as dungeon masters.

Download it from Visual Studio Gallery.

Useful links:

Sprite Sheet Packer

Sprite Sheet Packer (at is an excellent little utility for packing all sprites in a single large texture. It is very simple to use, simply add all the files that need to be packed and select destination file path and type. Transparency will be preserved for PNG images. For preventing issues when using mipmaps, you can add the padding around each image. Read the rest of this entry

Windows Phone Game Development Tips

Creating a new Windows Phone Game (4.0) project in Visual Studio creates bare minimum of what a game should be. However, two things remain to be set in order to make it look and feel like a proper game. Read the rest of this entry