Archive for the ‘Windows Phone 7’ Category

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.


Another week, another milestone. Yes, just like clockwork nearly every two-weeks the Marketplace adds another 1,000 apps to its belt (5K was on 12/28/10).

The good news is development doesn’t seem to be slowing (20K+ developers on board now), then again, it doesn’t seem to be growing more rapidly either. However, Microsoft’s app approval system may be fixed to only be able to push out 1k every two weeks and not really anymore. It’s all a mystery to us.

Regardless, at this rate we should hit 10,000 apps by the second week in March at which point we’ll have a party or something. All we know is we’re leaving WebOS in our dust and our next goal is to beat BlackBerry (16K apps). See previous 5,000 posthere with each previous 1,000 documented.

Source: Marketplacebrowser

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