Over the past several weeks I’ve been working on some content I’m excited to finally share with you through a series of blog posts. This series will introduce you to Windows Phone 8 development from an Android developer’s perspective. Through the course of the series you’ll create your first app. It won’t be anything pretty, but you’ll learn the ins and outs of the development environment, how to create a simple user interface, and how to perform navigation. Along the way you’ll see some Android Hints that will help make it easier for you to transition your existing skills to the Windows Phone platform. You’ll also see some Visual Studio Tips to make you more productive in your development environment. Good luck!

Your first task when it comes to Windows Phone development is getting your development environment up and running. It’s a three step process:

Install Windows 8

You can’t create Windows Phone apps on anything but a 64 bit version of Windows 8. There are two additional requirements for running the Windows Phone 8 emulator:

  • Windows 8 Pro edition or greater is required
  • Your machine must have a processor that supports Second Level Address Translation (SLAT)

What this means is that you can’t run a Windows Phone 8 development inside of a virtual machine. This is due to the Hyper-V technology used in the Windows Phone emulator.

For installing Windows 8 you have several options. If you’re running a Windows 7 machine, you can either upgrade your existing install, create a separate partition for you Windows 8 install, or create a bootable vhd with Windows 8 (this is not the same as running inside of a virtual machine).

Install Visual Studio Express 2012 for Windows Phone

Download and install Visual Studio Express 2012 for Windows Phone from http://aka.ms/getvs12now. Visual Studio is the IDE, similar to Eclipse, that you’ll use for creating Windows Phone applications. Please note, there are a five Visual Studio Express products available. Make sure you download and install the one specifically for Windows Phone.


There are two options for installation, a web installer and a disk image. A description of each is below, choose the one that works best for you:

  1. Web Installer – this is a small initial download that will download the necessary components during the installation process. Download at http://bit.ly/YSPmrh.
  2. Disk Image (iso) – This is the full installer, no additional downloads are required. Download at http://bit.ly/Tmb6rX.

If you already have a different edition of Visual Studio Express installed on your machine don’t worry, Visual Studio Express 2012 for Windows Phone will install just fine with it.

After you install Visual Studio you can try it free for up 30 days. After 30 days you must register to obtain a free product key for ongoing use. Just remember, it’s free as long as you register. You can register at http://bit.ly/URM0I8.

Optional: Join the Windows Phone Dev Center

This step is not required to start developing Windows Phone applications. However, if you want to test your apps on Windows Phone hardware and submit your apps to the Windows Phone Store, you must register for a Windows Phone Dev Center account. You can learn more about the Windows Phone Dev Center and register at http://bit.ly/StpJhE.

That’s it! You’re good to go. In the next lesson you’ll learn how to create your first Windows Store project.

 

Additional Resources

 

Over the past several weeks I’ve been posting about how to build your first Windows Store application if you’re an Android developer. I want to wrap this series by providing some useful links.

All Posts in this Series

  1. Setting up the Development Environment
  2. Creating Your First Windows Store Project
  3. Exploring the Windows Store Project
  4. Running the Windows Store Application
  5. Building a Simple User Interface
  6. Creating a Second Page
  7. Adding “Back” Navigation

If you would prefer a pdf of all seven posts you can get it here: http://aka.ms/AndroidToWindows8

Additional Windows 8 Development Resources

Over the past several weeks I’ve been working on some content I’m excited to finally share with you through a series of blog posts. This series will introduce you to Windows 8 development from an Android developer’s perspective. Through the course of the series you’ll create your first app. It won’t be anything pretty, but you’ll learn the ins and outs of the development environment, how to create a simple user interface, and how to perform navigation. Along the way you’ll see some Android Hints that will help make it easier for you to transition your existing skills to the Windows platform. You’ll also see some Visual Studio Tips to make you more productive in your development environment. Good luck!

As referred to in lesson four, there is no hardware “Back” button for Windows 8 devices. However, developers can add navigation to their apps using “Back” semantics. In this lesson you’ll learn how to navigate back to MainPage.xaml from SecondPage.xaml.

Start by opening MainPage.xaml and wrapping the <TextBlock> element in a vertical <StackPanel>. You should end up with something like this:


<StackPanel Orientation=”Vertical”>

<TextBlock x:Name=”messageFromUser” />


</StackPanel>

VISUAL STUDIO TIP

If you like your code to look “just so”, you can format it at any time by pressing Ctrl + K + D.

 

Now add a <Button> element under your <TextBlock> element, specifying the x:Name, Content, and Click attributes like so:

<StackPanel Orientation=”Vertical”>

<TextBlock x:Name=”messageFromUser” />


<Button x:Name=”goBack”


Content=”Go Back”


Click=”goBack_Click” />

</StackPanel>

Note: For the sake of this lesson a string resource was not added to Resources.resw for the message displayed in the <Button> element.

Open the code-behind file for SecondPage.xaml (press F7), and add the following method:


private
void goBack_Click(object sender, RoutedEventArgs e)

{


//Go back to MainPage.xaml if able to


if (this.Frame.CanGoBack)


this.Frame.GoBack();

}

ANDROID HINT

To perform similar navigation in Android you would enable “Up” in the action bar in your activity’s onCreate method:

 

@Override

public void onCreate(Bundle savedInstanceState) {


getActionBar().setDisplayHomeAsUpEnabled(true);


}

 

That’s all there is to it. Run your app (F5) and see what happens.

Congratulations! You just built your first Windows Store application. To learn more about building Windows Store apps, continue to follow this series. The next installment is Working with Data.

Previous Posts in this Series

  1. Setting up the Development Environment
  2. Creating Your First Windows Store Project
  3. Exploring the Windows Store Project
  4. Running the Windows Store Application
  5. Building a Simple User Interface
  6. Creating a Second Page

Additional Resources

I’m sure my wife will be the first to tell you this, but I am not a designer. Of course, I don’t pretend to be one either. However, there are times when I’m working on a Windows 8 or Windows Phone 8 app when I need a designer’s touch. Typically I’ll need a font, some imagery, an icon, or even a sound. Rather than spending hours working in Photoshop or Expression Design, I’ll go to a list of resources I’ve compile to find exactly what I’m looking for. Some charge, some don’t, and depending on what I need I’m more than willing to pay a fair price for the design asset I’m looking for. I thought I’d share my “go-to” design list for you in case you’re struggling to find what you need and you dread the thought of having to create something on your own

Fonts

Icons/Images

Sounds

Hope this helps!

Over the past several weeks I’ve been working on some content I’m excited to finally share with you through a series of blog posts. This series will introduce you to Windows 8 development from an Android developer’s perspective. Through the course of the series you’ll create your first app. It won’t be anything pretty, but you’ll learn the ins and outs of the development environment, how to create a simple user interface, and how to perform navigation. Along the way you’ll see some Android Hints that will help make it easier for you to transition your existing skills to the Windows platform. You’ll also see some Visual Studio Tips to make you more productive in your development environment. Good luck!

In the previous lesson you created a simple UI that accepts text from a user. In this lesson you’ll create a second page in your application to display the user’s input.

Create the Second Page

Right-click the project in Solution Explorer, click Add, and click New Item.

In the Add New Item dialog, select Windows Store under Visual C#.

Select the Blank Page template, give the page a name of SecondPage.xaml, and click Add.

You should now see SecondPage.xaml in Solution Explorer.

If SecondPage.xaml is not open, double-click it.

Add a <TextBlock> element to the <Grid> element. Be sure to specify its x:Name attribute;

<Grid Background=”{StaticResource ApplicationPageBackgroundThemeBrush}”>


<TextBlock x:Name=”messageFromUser” />

</Grid>

Respond to the Send Button

You now need to get the message from the first page to the second page. Start by opening up MaingPage.xaml.

To respond to the <Button> element’s Click attribute to the element

<StackPanel x:Name=”theStackPanel”

Orientation=”Vertical”>

<TextBlock x:Uid=”messageLabel” x:Name=”messageLabel” Text=”" />

<TextBox x:Name=”theMessage” />

<Button x:Uid=”sendButton” x:Name=”sendButton” Content=”"


Click=”sendButton_Click” />


</StackPanel>

ANDROID HINT

The Click attribute is similar to the android:onClick attribute of the Android <Button> element.

 

Open the code-behind file for MainPage.xaml (MainPage.xaml.cs) and add the following method:

private
void sendButton_Click(object sender, RoutedEventArgs e)

{

 

}

VISUAL STUDIO TIP

You can open a code-behind file for a file you’re working with in design view by pressing F7.

 

Now you need to do a couple of things. First you need to get the text the user entered, then you need to navigate to the second page. This can be accomplished by adding the following to the sendButton_Click method:

private void sendButton_Click(object sender, RoutedEventArgs e)

{


//Get the message from the <TextBox> element


var message = this.theMessage.Text;

 


//If the message is empty use a default


if (string.IsNullOrEmpty(message))

message = “Hello World!”;

 


//Navigate to SecondPage.xaml


this.Frame.Navigate(typeof(SecondPage), message);

}

ANDROID HINT

In Android you would create an Intent and call the startActivity method to navigate to the second page with code similar to the following:

 

public void sendButton_Click(View view) {

Intent intent = new Intent(this, SecondPageActivity.class);

startActivity(intent);

}

 

If you run your app now (F5) and press the button, you’ll notice that you go to the second page. We’ll work on displaying the message in the last part of this lesson.

Display the Message

Now that you’re able to navigate to SecondPage.xaml from MainPage.xaml you need to display the message the user entered.

Open SecondPage.xaml.cs (the code-behind file for SecondPage.xaml).

Locate the OnNavigatedTo method and add the following code:

protected override void OnNavigatedTo(NavigationEventArgs e)

{


//Get the message passed in from MainPage.xaml


var message = (string)e.Parameter;

 


//Display the message in the <TextBlock> element


this.messageFromUser.Text = message;


}

This simply retrieves the message from the first page and displays it on the second page.

Run the app (F5) to see the results!

Previous Posts in this Series

  1. Setting up the Development Environment
  2. Creating Your First Windows Store Project
  3. Exploring the Windows Store Project
  4. Running the Windows Store Application
  5. Building a Simple User Interface

Additional Resources

image

In case you missed, last week the Windows Azure Mobile Services shipped support for HTML clients. Here’s a recap.

The HTML client provides a JavaScript library that developers can use when building both Websites and PhoneGap/Apache Cordova apps.  The new HTML client combined with Cross-origin Resource Sharing (CORS) support helps developers leverage the great Mobile Services functionality available to native application developers today including:

  • Turn-key structured storage for your HTML5/JS applications
  • Authentication using common popular social identity providers such as Microsoft Account, Facebook, Twitter and Google
  • Scheduled scripts for performing periodic tasks in the background
  • Server script for push Notifications to native Windows Store, Windows Phone, iOS and Android apps
  • Partner services from the Windows Azure Store including SendGrid for email, Twillio for text/SMS and pusher for push to browser based clients         

Besides enable this great features, the team has created HTML client tutorials for the following scenarios on the Mobile Services developer center:

Getting started Get started with Mobile Services
Data Get started with data
Validate and modify data using server scripts
Add paging to your queries
Authentication/User Management Get started with authentication
Use scripts to authorize users
Services Send email from Mobile Services with SendGrid
Schedule backend jobs in Mobile Services
Tools Automate mobile services with command line tools

 

Why don’t you take it for a spin. Visit WindowsAzure.com and build your first HTML app using Mobile Services using the HTML Quick Start project in the Windows Azure portal.

image

That’s right.  You read the headline correctly.  The iPhone Developers Meetup is working with Microsoft in an effort to give our members the greatest opportunity to get their applications into the most marketplaces. We are partnering with Microsoft to give you the tools and resources you need to get your iOS applications into the Windows Store.

If you don’t have time to read the entire post, remember this:

  1. Access to software and hardware, including a Microsoft Surface device and Windows Phone device to test your applications on
  2. Information on how to port iOS applications or start a new application from scratch
  3. Access to the Microsoft development experts and the Twin Cities’ Microsoft Technology Center developer labs

This program is a partnership between the Twin Cities’ iPhone Developers Meetup and Microsoft to provide resources so our members can port or create applications for the Windows Store or the Windows Phone Store.  Between now and June 30th, members will have access to the developer kit, Microsoft developer experts and programs, and the Microsoft Technology Center’s developer labs.

The developer kit contains a Microsoft Surface device, HTC 8x Windows Phone, Windows 8 Pro evaluation bits, and a USB drive with resources, install guides, etc. for running a Microsoft development environment on a Mac.  You can contact John Hibscher (john_hibscher at yahoo.com) to schedule use of the kit for up to five days at a time.  If our group can get 15 or more applications into the Windows Store by June 30th, we will be able to keep the kit and will raffle off the Microsoft Surface, the HTC 8x, and a copy of Windows 8 Pro to the members that get applications submitted and approved. 

The Microsoft Technology Center is one of the premier facilities for Microsoft development.  At the MTC, you will be able to schedule time in one of the Windows 8 developer labs where you can use PCs that are state-of-the-art for doing Windows development.  In addition, Microsoft development experts will be on hand to answer any of your questions while you are there.  The MTC developer labs are a great place to get an app started or push it that last mile to completion.

In addition to the resources that are in the kit, here are some additional links to help get you started.

If you have more questions, or want more info, you contact me via email (adgroc at microsoft.com), on Twitter (@codel8r) of find me at my weekly Office Hours (Adam’s Office Hours)

Thanks and good luck coding!

Earlier today I presented a session at Mobile March on Windows 8 for HTML and JavaScript developers. Rather than give you my slides, I thought I’d give you links to resources on the various features I discussed. This will allow you to quickly and easily dive into the features that interest you. Here you go:

Tools http://aka.ms/getvs12now
WinJS http://aka.ms/WinJS
Animations http://aka.ms/WinJSAnimations
Tiles and notifications http://aka.ms/WinJSTiles
Push notifications http://aka.ms/WinJSPush
Media capture http://aka.ms/WinJSMedia

Hope it helps!

Over the past several weeks I’ve been working on some content I’m excited to finally share with you through a series of blog posts. This series will introduce you to Windows 8 development from an Android developer’s perspective. Through the course of the series you’ll create your first app. It won’t be anything pretty, but you’ll learn the ins and outs of the development environment, how to create a simple user interface, and how to perform navigation. Along the way you’ll see some Android Hints that will help make it easier for you to transition your existing skills to the Windows platform. You’ll also see some Visual Studio Tips to make you more productive in your development environment. Good luck!

A Windows Store application is simply a collection of pages. A page is the interface seen by the end user.

ANDROID HINT

A page is similar to an Activity in Android development

 

Each page is designed for the end user to interact with the application. A page is composed of layout controls and various widgets. Only one page can be seen by the end user at a time.

ANDROID HINT

Unlike Android, there is no system level “Back” or application level “Up” button. However, developers can implement navigation within their application through “Back” or “Up” button semantics.

 

To better familiarize yourself with the user interface components of a Windows Store application the following table maps Android widgets to their Windows Store counterparts:

Purpose

Android

Windows Store

Display Text

TextView

TextBlock

Edit Text

EditText

TextBox

Radio Button

RadioButton

RadioButton

Check Box

CheckBox

CheckBox

Time Input

TimePicker

TimePicker

Date Input

DatePicker

DatePicker

Submit

Button

Button

Show Progress

ProgressBar

ProgressBar

Display a List of Components

LinearLayout

StackPanel

Vertical List of Components

ListView

ListView

2-Dimensionl Grid

GridView

Grid

Display an Image

ImageView

Image

 

This is by no means an extensive list. As with many development technologies there are a number of ways to perform the same task. For example, instead of using a ListView to display a vertical list in a Windows Store app I could simply use a StackPanel and set its orientation property accordingly. I could also using a ProgressRing instead of a ProgressBar in a Windows Store app to display changes in progress.

In this lesson you’ll learn how to create a simple interface for your Windows Store application.

Add a Text Field

For your UI you’ll want a label to tell the user what to do, a field where users can input text, and a button. You’ll start by adding the text field.

Open the MainPage.xaml file in the root directory of your project.

VISUAL STUDIO TIP

When you open a *.xaml file you’ll first see a split view. The top view contains a visual designer. This lets you build layouts using WYSIWYG tools. The bottom contains the markup generated by the designer. For this lesson, you’re going to work directly with the XAML. To give yourself more screenspace you can go to a “XAML only” view using the following steps.

  1. Click the button on the toolbar between the designer and the markup view. This will move the markup view to the top and designer view to the bottom.
  2. Click the button on the toolbar between the two views. This will minimize the designer.

 

Add a <StackPanel> element to the <Grid> element that was added to the page when it was created. Your markup should look like this:


<StackPanel x:Name=”theStackPanel”


Orientation=”Vertical”>


</StackPanel>

 

ANDROID HINT

A StackPanel is equivalent to a LinearLayout in Android development. It allows you to lay out child elements in either a verity or horizontal orientation.

 

The x:Name attribute is similar to the android:id attribute. However, you are not required to provide a x:Name attribute for your visual elements.

 

The Orientation attribute is identical to the android:Orientation attribute of the LinearLayout in Android. The default value for the Orientation attribute is Vertical.

 

Now add a <TextBox> element inside of the <StackPanel> element you just created. Be sure to provide a x:Name attribute for it. You should end up with something like this:

<StackPanel x:Name=”theStackPanel”

Orientation=”Vertical”>


<TextBox x:Name=”theMessage” />


</StackPanel>

Add String Resources

Next you’ll want to add a label to your page to instruct the user on what to do. You might be tempted to add a <TextBlock> element and sent its Text attribute to the text you want displayed. While this will work, it goes against best practices for localization. Before you add the label to the page, you need to add a resource file to your project to store the text you want to display in the UI.

ANDROID HINT

A resource (*.resw) file to store strings is similar to the res/values/strings.xml file used in Android projects.

 

To add a resource file, start by right-clicking the Project in Solution Explorer, click Add, then click New Folder. This will add a new directory to the project. Name the directory Strings.

Add a subdirectory to the Strings directory entitled en-US.

Right-click the en-US directory, click Add, and click New Item. This will open the Add New Item dialog.

VISUAL STUDIO TIP

You can also add a new item by pressing Ctrl + Shift + A on the keyboard.

 

In the tree on the left-hand side of the dialog under the Visual C# node, select General. Then select Resource File (.resw) from the options presented.

Leave the name of the file as Resources.resw and click Add.

You should now see the Resources.resw file under the en-US directory in Solution Explorer.

If the Resources.resw file is not already open double click it.

Add the message you want to display to the user to Resources.resw. You should end up with something that looks like this:

The name of the string resource is important. As you see in the image above it’s in two parts. The first part specifies the name of the visual element the resources will be used for (in this case messageLabel). The second part specifies the name of the property of the visual element you want to use the resource for (in this case the text property).

Add a Label

With the Resource file in place you’re now ready to add the label to your page.

Open MainPage.xaml if not’s not already open and add a <TextBlock> element above the <TextBox> element in the <StackPanel>. In order to leverage the appropriate string resource be sure to set the x:Uid element of the label to the corresponding to the resource name. You should end up with something like the following:

<StackPanel x:Name=”theStackPanel”

Orientation=”Vertical”>


<TextBlock x:Uid=”messageLabel” x:Name=”messageLabel” Text=”" />

<TextBox x:Name=”theMessage” />

</StackPanel>

Add a Button

The last thing you’ll need to do as part of this lesson is to add a <Button> element to the page so you can send the message the user enters to a second page.

Before you add the <Button> be sure to add a string resource for its Content property in the Resources.resw file.

Now add a <Button> element under the <TextBox> element in MainPage.xaml, being sure to specify the appropriate x:Uid attribute for localization.

<StackPanel x:Name=”theStackPanel”

Orientation=”Vertical”>

<TextBlock x:Uid=”messageLabel” x:Name=”messageLabel” Text=”" />

<TextBox x:Name=”theMessage” />


<Button x:Uid=”sendButton” x:Name=”sendButton” Content=”" />


</StackPanel>

Congratulations! You just created your first Windows Store UI. It might not be pretty, but it works. You can run your app now (press F5 or F6 to see the results).

Previous Posts in this Series

  1. Setting up the Development Environment
  2. Creating Your First Windows Store Project
  3. Exploring the Windows Store Project
  4. Running the Windows Store Application

Additional Resources

Earlier today I presented a session at Mobile March on the new features in Windows Phone 8.

Rather than give you my slides, I thought I’d give you links to resources on the various features I discussed. This will allow you to quickly and easily dive into the features that interest you. Here you go:

Overview of all new features http://aka.ms/WP8Goodies
App models http://aka.ms/WP8AppModels
App monitoring http://aka.ms/WP8AppMonitoring
Simulator dashboard http://aka.ms/WP8SimDashboard
Tile templates http://aka.ms/WP8TileInfo
Lock screen notifications http://aka.ms/WP8LockScreen
Lock screen background http://aka.ms/WP8LockScreenBackground
Speech http://aka.ms/WP8Speech
Maps and navigation http://aka.ms/WP8MapsInfo
Location http://aka.ms/WP8LocationInfo
Launchers http://aka.ms/WP8Launchers
Wallet http://aka.ms/WP8Wallet
Lenses http://aka.ms/WP8Lenses
VoIP http://aka.ms/WP8VoIP
Bluetooth http://aka.ms/WP8Bluetooth
Proximity http://aka.ms/WP8Proximity
Data sense http://aka.ms/WP8DataSense
Search extensibility http://aka.ms/WP8SearchExt
Company app distribution http://aka.ms/WP8CompanyHub
Windows Azure Mobile Services http://aka.ms/WP8MobieServices

Hope it helps!