Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Your First Windows Phone 7 App is Just a Few Keystrokes Away

0.00/5 (No votes)
21 Nov 2015 1  
Your first Windows Phone 7 app is just a few keystrokes away

Just by looking at the title of the article, don't think that this isn't for you, in fact this article is intended for all those who are interested in knowing how a mobile app is being developed and deployed. And to understand this, you need not be a hard core developer or you are not even required to be working in the telecom domain... just an urge to know and learn is enough.

Before actually getting into our first app development, let me brief you about the current state of the art of mobile phone application development. Mobile apps are being developed for multiple platforms and the current well known platforms which are buzzing with high app development activities are:

  • Apple iOS
  • Android
  • Symbian
  • Windows mobile

All of these platforms have their own well established developer communities well known as "ecosystems", developers from these ecosystems constantly contribute to the community by developing apps which fall into wide range of categories, like Business, Entertainment, Utility, Multimedia, etc.

The well known app stores of today are OVI store by Nokia, iStore by Apple, Market Places by Microsoft and Android Market by Google.

In this article, I'm going to show you how an app can be developed for Windows Phone 7. I have chosen Windows Phone not because I'm biased, but simply because of the fact that it's very easy to set up the development environment, straight forward to understand, and requires very less development efforts.

So, let's get started.

At the time of writing this article, Microsoft had just released beta version of Window Phone 7.1 developer tools. But since this is an introductory article to Windows phone app development, I'm sticking to Windows Phone 7.0 development environment.

The minimum requirement to have Windows Phone 7.0 development environment is that your machine should be running at least windows 7 OS, next:

  1. Download SDK from here
  2. Apply patch

By now, your dev environment for Windows Phone 7.0 is up and running, The Windows phone applications are Silverlight applications written in "C#" language and will be running on Silverlight framework.

As our first application, I'll be showing you how to create a login page for Facebook application.

After you've installed the Windows Phone Developer Tools, the easiest way to create your first application is to use Visual Studio.

  1. On the Start menu, launch Microsoft Visual Studio 2010 Express for Windows Phone.
  2. On the File menu, click New Project.
  3. From the project templates, select Silverlight for Windows Phone and choose Windows Phone Application.
  4. Name the project and click OK.

  5. A new Silverlight app for Windows Phone project is created and opened in the designer.
  6. Edit the user interface as required by adding controls from the tool box and editing "XAML"

  7. Write event handlers for " Log in " and " Exit " buttons. In this example, the user name and password is hard coded as "vdr" and "admin" for successful log in case.
    namespace FacebookLoginPage
    { public partial class MainPage : PhoneApplicationPage
      { public MainPage()   {
         InitializeComponent();
       }   private void BTN_Login_Click(object sender, RoutedEventArgs e)
       {
        if (TB_UserName.Text.Equals("vdr") && TB_Password.Text.Equals("admin"))
        {
         MessageBox.Show("Login Successful");
        }
        else
        {
         MessageBox.Show("Enter Valid Credentials");
        }
       }
    
       private void BTN_Exit_Click(object sender, RoutedEventArgs e)
       {
        NavigationService.GoBack();
       }}}
  8. That's all. Your app is ready to launch. Compile the code and run it in Windows Phone 7 emulator.

Here are the screen shots of application functionality:

  1. Once the emulator comes up, your application can be seen in the list of applications displayed. Here we can see the app "FacebookLoginPage" which we have just created.

  2. Launch the application, and you are directed to Home screen of the application.

  3. Log in with valid credentials.

  4. Successful log in.

  5. Log in failed.

With this, we have successfully created our first Windows Phone 7 app and also reached the end of this article, but before putting a full stop, I would like to highlight a few things.

Mobile phone application development is not rocket science. It's more of a fun filled and challenging activity. Since these days, as the mobile phones are becoming an integral part of our lives, the phone user base is also rapidly growing and this has exponentially triggered the need for various kinds of mobile apps for people working in diverse domains.

And it's time to put in all your creative ideas and create great applications to serve the human community in a much better way.

Goodbye for now.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here