Language Choices

As you can see from the earlier WinRT diagram (see Figure 23.7), another benefit of having WinRT in the picture is that you are no longer limited to your typical stable of managed code languages. So although you could develop your application C# or Visual Basic, all the WinRT objects are also available to JavaScript/HTML and C++ code. This widens the playing field quite a bit. There are no second-class citizens in the equation: WinRT is an equal-opportunity API. As a developer, you are free to concentrate on the toolset that you feel most comfortable with from a skill set and background perspective. The tooling and the API are there to support you.

With WinRT, you can develop a Modern UI application using DirectX, HTML/JavaScript/CSS, C#, Visual Basic, or C++. Each language will have a set of common and a set of unique project types.

HTML and JavaScript and CSS

For developers coming from the web side of the business, Hypertext Markup Language (HTML), JavaScript, and Cascading Style Sheets (CSS) are familiar and capable technologies. Building a WinRT application using these languages results in a structure that is similar, if not identical, to a website/application:

Image CSS is used for the presentation (that is, the layout and styling of the user interface).

Image JavaScript is used to code the behavior (the way the app handles interactions, events, business rules, and so on).

Image HTML is used for the structure of the content within the UI.

To create a JavaScript application, click File, New Project, and then locate the JavaScript language selection to the left (see Figure 23.8).

Image

FIGURE 23.8 Creating a JavaScript application.

Note that there are five selections to choose from, as described in Table 23.1.

Image

TABLE 23.1 The JavaScript Project Choices

Figure 23.9 shows the default project structure for an HTML/JavaScript application.

Image

FIGURE 23.9 The project structure of an HTML/JavaScript application.

C#/Visual Basic/XAML

Developers more familiar with WPF or Silverlight will benefit from using the XAML with C# or Visual Basic project templates, with this choice:

Image XAML styles are used for the presentation.

Image C# or Visual Basic is used to code the behavior.

Image XAML is used for the structure of the content within the UI.

To create a XAML application, click File, New Project, and then locate the C# or Visual Basic language selection to the left (see Figure 23.10); then select Windows, and then Windows 8.

Image

FIGURE 23.10 Creating a C# XAML application.

With C# XAML projects, note that there are four primary UI project selections to choose from, as described in Table 23.2.

Image

TABLE 23.2 The XAML Project Choices

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset