Getting started with Hilo (Windows Store apps using C++ and XAML)
Here we explain how to build and run the Hilo Windows Store app, how the C++ and XAML source code is organized, and what tools and languages it uses.
After you download the code, see Building and running the sample on this page for instructions.
Build the Hilo project as you would build a standard project.
- On the menu bar, choose Build > Build Solution. The build step compiles the code and also packages it for use as a Windows Store app.
- After you build the project, you must deploy it. On the menu bar, choose Build > Deploy Solution. Microsoft Visual Studio also deploys the project when you run the app from the debugger.
- After you deploy the project, pick the Hilo tile to run the app. Alternatively, from Visual Studio, on the menu bar, choose Debug > Start Debugging. Make sure that Hilo is the startup project.
You can run Hilo in any of the languages that it supports. Set the desired language from Control Panel. For example, if you set the preferred language to Arabic (Saudi Arabia) before you start Hilo, the app will display Arabic text right-to-left and use the default calendar for that locale. Here is a screen shot of the year groups view localized for Arabic (Saudi Arabia).
The Hilo source code includes localization for Arabic (Saudi Arabia), English (United States), German (Germany) and Japanese (Japan).
The Hilo Visual Studio solution contains three projects: Hilo, HiloTests, and CartoonEffect.
The Hilo project uses Visual Studio solution folders to organize the source code files into these logical categories:
- The Assets folder contains the splash screen, tile, and other images.
- The Common folder contains common page and navigation functionality for the app.
- The ExceptionHandling folder defines the policies and classes for dealing with unhandled exceptions.
- The Imaging folder contains imaging extension code and helpers.
- The Models folder contains repository code and other classes that are used by viewmodels.
- The Strings folder contains resource strings, with subfolders for each locale.
- The Tile folder contains the code that updates the app's Start screen tile.
- The ViewModels folder contains the application logic that is exposed to XAML controls.
- The Views folder contains the app's XAML controls.
- The XamlExtensions folder contains data converters and other utilities.
The HiloTests project contains unit tests for Hilo. It shares code with the Hilo project and adds source files that contain unit tests. The CartoonEffect project implements an image processing algorithm that applies a cartoon effect to an image, packaged as a static library.
You can reuse some of the components in Hilo with any app with little or no modification. For your own app, you can adapt the organization and ideas that these files provide. When we consider a coding pattern to be especially applicable in any app, we call it out here.
Hilo is a Windows Store app that uses C++ and XAML. This combination is not the only option. You can write Windows Store apps in many ways, using the language of your choice. When we considered which language to use for Hilo, we asked these questions:
- What existing code can we bring forward? If you have existing code, algorithms, or libraries that work with Windows Store apps, you can bring that code forward. For example, if you have existing app logic written in C++, you might consider creating your Windows Store app with C++.
We chose C++ for performance and because it matched our skillsets. We believed that a full photo app would likely perform compute-intensive image processing such as image filter effects, and we knew that C++ would let us best take advantage of the multicore and GPU capabilities of the hardware platform in this case. For example, Hilo uses C++ Accelerated Massive Parallelism (C++ AMP) to implement a cartoon effect. C++ gave us a direct path to libraries such as C++ AMP and the Parallel Patterns Library (PPL).
We chose XAML for developer productivity. We believed that XAML's declarative UI approach and many built-in features would save us time and let us focus on design and core app logic.
We chose Visual Studio Express as our environment to write, debug, and unit test code, Team Foundation Server to track planned work, manage bug reports, version source code, and automate builds, and Blend for Visual Studio to design animations.
The document Your first app orients you to the language options available.