Archive for the ‘Development’ Category

Because you’re reading this magazine, there’s a good chance you sling code for a living. And if you sling code for a living, you probably spend a lot of time in your IDE … which is—because you’re reading this magazine—probably Visual Studio.

Visual Studio 2010 is already an incredibly versatile coding tool. It does pretty much everything except write the code for you, and in many cases it’s getting good at doing that, too. Still, Visual Studio can’t do it all out of the box.

That’s where extensions come to the rescue. Visual Studio 2010 provides robust support for extensibility via custom tools, templates and plug-ins. (Note, however, that the Express versions of Visual Studio don’t support extensions.) If you can’t find the feature you need in Visual Studio, chances are there’s an extension that helps you customize the IDE or provides the tools you need to write code better and faster.

We’ll cover a few of the most popular free extensions for Visual Studio 2010.

Power Tools for Visual Studio There are thousands of extensions out there, and it just so happens that one of the most robust extensions was created by the Visual Studio team. Visual Studio 2010 Productivity Power Tools ( is a package of 15 handy features that range from Solution Navigator (think Solution Explorer on steroids) to tab autocompletion and highly configurable enhancements to tabs. Scott Guthrie explains how each of the features in Productivity Power Tools works on his blog, so check that out for details (

image: Solution Navigator in Productivity Power Tools

Solution Navigator in Productivity Power Tools

PowerCommands 10.0 PowerCommands 10.0 (, like Productivity Power Tools, is a grab bag of useful extra tools that will speed up or simplify common tasks in the IDE. You get 25 features in the package; they include robust copy and paste enhancements (copying entire classes, for example). The package also includes the ability to format your code, sort using statements and remove unused using references when saving.

Team Foundation Server Power Tools September 2010 Don’t feel left out if you’re using Visual Studio Team Foundation Server (TFS). Microsoft has a set of Power Tools for you, too. This extension ( gives you 11 new features that include check-in policies and item templates, a process editor, TFS command-line tools and Windows Powershell cmdlets, team member management, Windows shell integration and automated database backup.

Visual Studio Color Theme Editor It may not sound as glamorous, but sometimes it’s the little details that make coding that much easier. Take the colors used in the Visual Studio windows, tabs and menus, for instance. Do brighter colors cheer your mood? Are you particularly fond of magenta? Whatever you prefer, Visual Studio Color Theme Editor ( lets you customize all of the environment colors used in the IDE. You can also save themes and share them with your friends.

StudioStyles An even more personal choice is the colorization used for the code itself in your editor. StudioStyles ( is a Web site that lets you download, create and share the .vssettings files that specify code colorization. Added bonus: These themes can be used with Visual Studio 2010, 2008, 2005 and even the Express versions.

image: StudioStyles


WordLight Do you ever want to quickly find all the places you’ve used a method or variable name? WordLight ( is a simple extension for Visual Studio 2008 that lets you select some text and instantly highlights all other occurrences of that string in the code file. It also works in the Output, Command and Immediate windows.

Spell Checker If y0u tpye lke I do, the Spell Checker is a lifesaver. The Spell Checker extension ( looks for errors in the non-code portions of your files. It works in any plain-text files, for comments and strings in source code, and for non-tag elements of HTML and ASP files.

TortoiseSVN Add-in for Visual Studio So you’ve written and tested your code. If you’re working on a team or open source project, you probably need to commit your source to a repository. There’s a tool for that.

If you’re using Apache Subversion ( source control along with a TortoiseSVN client for Windows (, there are a couple of Visual Studio extensions that incorporate the TortoiseSVN functionality into the IDE (, saving you many steps in the commit process.

VsTortoise When using TFS, you’ll need to add a layer such as SvnBridge ( that translates APIs between Subversion clients like TortoiseSVN ( and TFS.

Another popular source-code management system is Git (, and if that’s your preferred repository, then there’s an extension for you, too. Git Extensions ( includes shell extensions for Windows Explorer and a Visual Studio plug-in. Plus, you can run most features from the command line.

NuGet Inspired by RubyGems and similar package-management systems from the Linux development world, NuGet ( gives Microsoft .NET Framework developers the ability to easily incorporate libraries from source-code repositories directly into their local development projects. NuGet integrates with the Visual Studio 2010 IDE, and you can also run NuGet from the command line or via Windows PowerShell cmdlets.

image: NuGet


Emacs and Vim Emulation In the beginning there was vi, and it was difficult to learn. Since those early days, Emacs and Vim have battled for supremacy as the One True Editor among coders. If you’ve chosen sides in that debate, yet find yourself using Visual Studio, then rejoice! The keybindings and many other features you know and love from Emacs and Vim are now available in extensions for Visual Studio.

You can follow the progress of VsVim ( developer Jared Parsons via his blog ( More information about Emacs emulation (, along with lots of other great tips, can be found on the Visual Studio Team blog (

A Gallery of Extensions This is just the tip of the iceberg as far as Visual Studio extensions are concerned. Thousands of templates, custom controls and extensions are available through the Visual Studio Gallery (, and more are being added all the time. Many are free, and there are trial versions available for many of the commercial products.

Write Your Own Extensions Don’t see what you need in the Visual Studio Gallery? Write your own! Visual Studio 2010 includes deep hooks for extensibility—anything from a custom project template to third-party tools that integrate directly with the IDE. Through the Extending Visual Studio developer center (, MSDN Library articles and other resources in the Visual Studio community (, you’ll find a vast amount of information to start creating custom Visual Studio extensions. You’ve already got the tools … start coding! 

Source: Terrence Dorsey

About the Author:

Terrence Dorsey is the technical editor of MSDN Magazine. You can read his blog at or follow him on Twitter at @tpdorsey.


1.) The WP7 AppHub

This is more then just the place to buy or sell your WP7 applications.  From the education tab (the link I shared above) you can get code samples for anything from simple silverlight apps to 2-D and 3-D XNA games.

2.) Windows Phone 7 Development for Absolute Beginners

If you are start off from scratch (either a beginner programmer or transferring from another language), this is the place for you. This is step-by-step for the absolute beginner

3.) Tim Heuer’s Blog

Tim Heuer not only talks on all things silverlight, but also dabbles in the WP7 phone from time to time with some really great insight.

4.) The UI and Interaction Guide for WP7

I know, I know, as a developer you usually stay away form UI stuff… but for WP7 you really need to understand this stuff.  These guides will bring you up to speed.

5.) The Windows Phone 7 Training Course

For those that are more than beginners but still want a step by step approach to building an WP7 application, the hands-on-labs here will get you going.

6.) Charles Petzond’s Free Programming Windows Phone 7 book

What else do I need to say… it’s a free book Smile

7.) Shawn Wildermuth’s Developing for the Windows Phone 7 Series

Shawn does a great hands on course on Windows Phone 7.  This series scratches the surface on what his class offers.

8.) Windows Phone 7 Sample apps

A great list of sample applications for you to learn from from Compiled Experience blog.

9.) Windows Phone 7 and Azure

WP7 and Azure, a love story…. no, just kidding.. but it is a great set of post on how to use WP7 with Azure Cloud Services with Bart Merchtem

10.) Windows Phone 7 Patterns and Practices

The definitive guide to the how and the why on Windows Phone 7


Source: Deniel : The Sociable Geek

Note for the Author

I would like to present me special thank to Deniel to spending time in collecting those important learning sources and making them available to developers who wants to start development for Microsoft’s latest Mobile Platform i.e. WP7.

Obfuscation for WP7

Posted: December 29, 2010 in Development, Windows Phone 7

Microsoft released in November 2010, a Windows Mobile Marketplace Anti-Piracy Model white paper .This describes which methods were applied and ultimately be against WP7 prepared to be among about piracy. If you read between the lines, however, more accurately, there remains in effect, that all measures were taken which also cost effective as well. This does, conversely, that security only to a certain level is necessary and loopholes exist apparently can. So what can you do about yourself in order to protect other hand, its application?


Without wishing to delve into the technical details and do the “piracy” to support here, just the theoretical foundation is created that is attached to the follow.

Suppose it would be possible to obtain the certified installation files from the Market Place, without the need to buy if necessary. While installing even the signature is verified, but it also assumed here these would be overcome. In theory, you could then copy applications and free install.

This in itself is bad. Worse, however, that the source code of your application almost free building supplies.

Take, for demonstrating that super cool “Hello World” sample. The user interface is very appealing:


The associated Sourceode is kept super slim:


Like any other application for WP7 also has this application installed in the form of a XAP file. This is nothing other than a ZIP archive containing all the related files, including how to execute the assembly.

In the debug folder of the project can be found, therefore these files:


Suppose you had bad intentions and wanted to see how the application works as an interest such as the authentication mechanisms and other functions of an application that perhaps should not be made publicly available in order not to compromise its own systems.

Each assembly can be provided that is not protected, with the . NET Reflector to inspect more closely.This is what our assembly of the killer application of the Reflector.


Would be not only our “Hello World” mentioned but really important and valuable source code, one would want this information in a short time on screen, what is most likely not desired.

(For background, why this is possible with assemblies, we recommend this article )


How can you prevent the counter but is not it?

Can not completely prevent it. One can only drive the cost of this in the air. We can print as much driving up, that the effort “decode” to this information is so high that it is no longer worthwhile. It is possible, but still.

For this purpose, applied the so-called “obfuscation”, or “concealment”. This method name be obliterated, and strings quasi encrypted. The same source code looks obfuscated, like this:


We see here that the method name was obscured and the string, as well as the method call are not as recognizable.

(For more on the background of an obfuscation, it is here )

In order to achieve their own application obfuscation, you need a program. Currently, provides theDotfuscator by PreEmptive Solutions , as these can be used free of charge 31.03.2011 up yet. If the name sounds familiar: A Community Edition was part of the Visual Studio installation to version 2008.


With the Dotfuscator can conceal their own assembly and increase the effort to “decode”.

However, there are still a few points to note before you weigh in security:

  • A veiled Assembly needs a little more performance is not disguised as one.
  • Important strings, and functions should still be moved to a server if possible. Even if the effort should be high in an assembly to “decode” it is safer not at first to offer this attack.

Special Note for the Author

I would like to thank the Author “Peter Nowak” of this article for giving me the permissions to translate it from German. The whole purpose for this translation was to just to make the readers comfortable who don’t know the German Language. I really appreciate the effort being done by Peter Nowak for this article and wish him best of luck for his upcoming articles and efforts.

Source: Translated From German to English Using Google Translator

Often times, you want to take a screenshot of an application’s page. There can be multiple reasons. For instance, you can use this to provide an easy feedback method to beta testers. I find this super invaluable when working on integration of design in an app, and the user can take quick screenshots, attach them to an email and send them to me directly from the Windows Phone device. However, the same mechanism can also be used to provide screenshots are a feature of the app, for example if the user wants to save the current status of his application, etc.


Note the following:

  • The code requires an XNA library to save the picture to the media library. To have this, follow the steps:
    • In your application (or class library), add a reference to Microsoft.Xna.Framework.
    • In your code, add a “using” statement to Microsoft.Xna.Framework.Media.
    • In the Properties folder, open WMAppManifest.xml and add the following capability: ID_CAP_MEDIALIB.
  • The method call will fail with an exception if the device is connected to the Zune application on the PC. To avoid this, either disconnect the device when testing, or end the Zune application on the PC.
  • While the method call will not fail on the emulator, there is no way to access the media library, so it is pretty much useless on this platform.
  • This method only prints Silverlight elements to the output image. Other elements (such as a WebBrowser control’s content for instance) will output a black rectangle.

The code

public static void SaveToMediaLibrary(
    FrameworkElement element, 
    string title)
        var bmp = new WriteableBitmap(element, null);

        var ms = new MemoryStream();
        ms.Seek(0, SeekOrigin.Begin);

        var lib = new MediaLibrary();
        var filePath = string.Format(title + ".jpg");
        lib.SavePicture(filePath, ms);

            "Saved in your media library!",
            "There was an error. Please disconnect your phone from the computer before saving.",
            "Cannot save",
  • This method can save any FrameworkElement. Typically I use it to save a whole page, but you can pass any other element to it.

  • On line 7, we create a new WriteableBitmap. This excellent class can render a visual tree into a bitmap. Note that for even more features, you can use the great WriteableBitmapEx class library (which is open source).

  • On lines 9 to 16, we save the WriteableBitmap to a MemoryStream. The only format supported by default is JPEG, however it is possible to convert to other formats with the ImageTools library (also open source).

  • Lines 18 to 20 save the picture to the Windows Phone device’s media library.

Using the image

To retrieve the image, simply launch the Pictures library on the phone. The image will be in Saved Pictures. From here, you can share the image (by email, for instance), or synchronize it with the PC using the Zune software.

Saving to other platforms

It is of course possible to save to other platforms than the media library. For example, you can send the image to a web service, or save it to the isolated storage on the device. To do this, instead of using a MemoryStream, you can use any other stream (such as a web request stream, or a file stream) and save to that instead.

Hopefully this code will be helpful to you!

Source: Laurent

While writing application that host the WebBrowser control, you’ll need to support refresh, back and forward for the web page shown in the WebBrowser control. While looking at the API for the WebBrowser control you’ll noticed quickly that it wasn’t suppored on the control.  But you can use the InvokeScript call to tell the page to perform these actions:

private void refreshButton_Click(object sender, EventArgs e)
  browser.InvokeScript("eval", "history.go()");

But when you ran this code, you will get obscure errors (actually, probably COM exception codes, e.g. 80004001). I couldn’t figure out what was going on but then I found the solution:

<phone:WebBrowser x:Name="browser"
                  IsScriptEnabled="True" />

Without enabling scripting, invoking script doesn’t work. Its obvious but hard to discover since the error messages are obscure.  Because the operations may fail if the page has handled certain types of scripts or has a function called eval, you should trap errors in the application.  Here’s what my final Back, Refresh and Forward button functionality look like:

private void backButton_Click(object sender, EventArgs e)
    browser.InvokeScript("eval", "history.go(-1)");
    // Eat error

private void refreshButton_Click(object sender, EventArgs e)
    browser.InvokeScript("eval", "history.go()");
    // Eat error

private void forwardButton_Click(object sender, EventArgs e)
    browser.InvokeScript("eval", "history.go(1)");
    // Eat error

I hope this helps you’ve run into this problem!

Reference :

Through an email to Windows Phone 7 developers Microsoft has informed that 16 categories and 25 sub-categories of apps will be included to Marketplace for Windows Phone 7.

List of Categories of Windows Phone 7 Apps in Marketplace

  1. Books & Reference
  2. Business
  3. Entertainment
  4. Finance
  5. Games
      Action & Adventure
      Board & Classic
      Card & Casino
      Puzzle & Trivia
      Sports & Racing
      Xbox Companion
  6. Health & Fitness
      Diet & Nutrition
  7. Lifestyle
      Food & Dining
      Out & About
  8. Music & Video
  9. Navigation
  10. News & Weather
  11. Photo
  12. Productivity
  13. Social
  14. Sports
  15. Tools
  16. Travel
      City Guides
      Travel Tools

Apps for Windows Phone 7 will be approved by Microsoft before they added to Marketplace for users and company will start accepting apps in October 2010.


In an attempt to start changing this blog from nothing but a platform for me to spout off about projects, or talking aboutcontests :) , and actually try to provide some value to readers, I’m starting a new category on the site called “Quick tips”.  When I can, I’ll be posting small bits of code that I think would be helpful.  If you have a question on how I’ve done anything in the applications I’ve written (more to be posted soon), please feel free to ask, and I’ll answer what I can.

On my last post, Ishmeet asked if I could shed a bit of light on how I was able to play the audio clips in the PhoneTree application, so here goes:

One of the best things about having both Silverlight and XNA at your disposal when developing for WP7 is that you can use the XNA pieces within your Silverlight app when ever you want.

For the MediaPlayer functionality you’ll need to add the Microsoft.Xna.Framework.dll reference.  Once you’ve done that, use the following code:

1  MediaPlayer.Stop();

2  Song song = Song.FromUri("Sample Song", new Uri(txtUrl.Text ) );

3  MediaPlayer.Play(song);

If you try and run the code at this point, it will play, but the application will also crash complaining that FrameworkDispatcher.Update has not been called.  After looking around for a while I finally found a post by Danny on the XNA Team explaining the problem.  He did a better job explaining it then I can so you can read it here.

Basically you’ll need the following class:

01 public class XNAAsyncDispatcher : IApplicationService

02 {

03       private DispatcherTimer frameworkDispatcherTimer;


05       public XNAAsyncDispatcher(TimeSpan dispatchInterval)

06      {

07           this.frameworkDispatcherTimer = new DispatcherTimer();

08           this.frameworkDispatcherTimer.Tick += new EventHandler(frameworkDispatcherTimer_Tick);

09           this.frameworkDispatcherTimer.Interval = dispatchInterval;

10      }


12        void IApplicationService.StartService(ApplicationServiceContext context)  { this.frameworkDispatcherTimer.Start(); }

13        void IApplicationService.StopService() { this.frameworkDispatcherTimer.Stop(); }

14        void frameworkDispatcherTimer_Tick(object sender, EventArgs e) { FrameworkDispatcher.Update(); }

15 }

and then add it to the Application Lifetime Objects like so:

1  this.ApplicationLifetimeObjects.Add(new XNAAsyncDispatcher(TimeSpan.FromMilliseconds(50)));

Once you’ve done that, your good to go.

Here is a sample showing off this technique.

Source: 4MK Mobile Dev Blog