Development of the first application for Windows Phone: Preparing the working environment. How to create an application for Windows Phone
There is an opinion that in real life smartphones with Microsoft OS are found as often as people with the patronymic “Artemovich”. Strange (to put it mildly) policy of “Evil Corporation” regarding the seventh and eighth families of mobile phones operating system turned many users away from experimenting with “windows” for smartphones, and now the corporation has seriously taken up the task of correcting its image in this user niche. As an underground Microsoft fan, I hope that everything will work out for them - the “top ten” is walking around the planet, its main trump card is one core for all platforms, and therefore it has every chance of winning over good part mobile market. And as a programmer, I will be happy to make for you an introductory article on development for this mobile axis, so that you are always ready for the growth of its popularity :).
Architecture overview
Thanks to the common core and UWP app runtime system, once written, an app will run on all devices running Windows 10. This range includes:
- desktop computers;
- server systems - OS Windows Server 2016;
- laptops - MS Surface Book;
- tablets - MS Surface Pro;
- smartphones - Lumia;
- game consoles - Xbox One;
- augmented reality glasses - MS HoloLens;
- wall tablets - MS Surface Hub;
- smart watch - MS Band 2.
The list is impressive. Moreover, UWP is not limited to just execution application programs, it also supports the operation of drivers at the kernel level. This allows you to create drivers that function on various devices, provided that the specific component for which the driver is intended is the same.
UWP supports both kernel-level and user-level drivers. The subsystem includes device driver interfaces ( Device Driver Interface - DDI), of which the UWP driver can use.
But all this does not save the developer from adjusting the interface to certain platforms and screen resolutions. In some special cases, this may not be necessary.
Developer Tools
To write, debug, deploy and test applications for Windows 10 Mobile, you will need Visual Studio 2015 (who would doubt it). This summer the third update was released. I strongly recommend it! Its main bugfix is reduced memory consumption compared to the second update.
You will also need Windows 10 Anniversary Update SDK: it includes all the necessary tools for developing applications for the entire fleet of devices running Windows 10. If you are using VS 2015 with the third update, then it already includes the latest SDK.
One of the main innovations is Windows Ink. Using this API, you can add pen support in two lines of code. There are two control objects for this: InkCanvas and InkToolbar.
The new Cortana API makes it easier to implement voice control. The Cortana Actions component in the new API allows you to create new phrases/expressions.
Windows Hello biometric authentication is now available to web developers in the Edge browser.
Blend UI Modeling Tool for Visual Studio 2015 provides advanced interface building capabilities compared to VS. With its help, you can create layouts in XAML for all supported applications: application, web, universal, mobile, and so on. It also contains constructors for additional tasks, including creating animations and controlling the behavior of elements.
Ways to create apps for Windows 10 Mobile
The main way to create applications for smartphones with Windows 10 Mobile is to develop Universal (UWP) apps(Scroll Visual C# → Windows → Universal New Project Wizards).
However, he is not the only one. As you know, in Visual Studio 2015 has Xamarin built in, with its help you can also create applications for Windows 10 Mobile, simultaneously for Android and iOS, changing the interface and leaving the program logic in C# (Visual C# → Cross-Platform).
In addition to the Visual C# language, Visual Basic or Visual C++ can be equally selected. VS 2015 allows you to create Universal Apps using JavaScript (JavaScript → Windows → Universal Apps). They can also be deployed to a Windows 10 Mobile device.
Tools for working with legacy projects
Over the long history of the Windows operating system, a colossal number of the most different applications. WITH Windows release 8 and WinRT (and later Windows 10 and UWP), the old desktop applications are a thing of the past, since only desktop Win 8 and Win 10 support classic Win32, COM, .NET applications. This made Microsoft sad. But the guys realized that they could develop a converter that would convert old applications for the new advanced UWP subsystem. From this was born Desktop App Converter.
Converting an Xcode project is done in two steps. First you need to add syntax highlighting for the Objective-C language in Visual Studio: install the objc-syntax-highlighting.vsix extension from the winobjc\bin folder. Then using the utility command line vsimporter.exe needs to convert the Xcode project into a VS project. After this, the resulting sln file can be opened in the studio, where the Objective-C syntax will be highlighted. You can build and run the application, it will run just like all other Windows programs.
Damn me, how amazing it is to see Objective-C code correctly highlighted in Visual Studio!
A free compiler is used to compile Obj-C code Clang. Since the output is a standard UWP application, it can be run on a mobile device in Windows 10 Mobile. One program can contain code in C++ and Obj-C.
![](https://i0.wp.com/xakep.ru/wp-content/uploads/2016/10/1477467842_113d_teapot.jpg)
If you have a project for previous version Windows Phone, that is, 8.1 (or 8.0), then when you open it in VS 2015, the studio will automatically update the project to meet the requirements of the Universal Windows App (UWP). Not only the user interface markup in XAML will be converted, but also the program logic in JS/C++/C#/VB along with it. If there were calls to the WinRT subsystem in the code, then they will be converted to UWP calls.
There is another common type of application - games. iOS and Android render using a low-level OpenGL interface. On the other hand, on Windows 10 Mobile, DirectX 11 is used to display images in games. This results in incompatibility. But there is a solution - the open source project ANGLE. ANGLE (Almost Native Graphics Layer Engine) - almost native graphics layer engine - allows Windows users Run OpenGL ES applications seamlessly on hardware running DirectX 11. This is achieved by converting calls from the OpenGL ES API to the DirectX 11 API. ANGLE fully supports the following three types of applications:
- universal applications for Windows 10 (Universal Windows apps);
- applications for Windows 8.1 and Windows Phone 8.1;
- classic desktop apps Windows desktop(Windows desktop applications).
The issue is discussed in more detail in my book “The Magic of Torque” (again, you’re promoting your book! Well, okay, you deserve it. - Ed.).
Continuation is available only to subscribers
Option 1. Subscribe to Hacker to read all materials on the site
Subscription will allow you to read ALL paid materials on the site within the specified period. We accept payment bank cards, electronic money and transfers from mobile operator accounts.
Articles and Lifehacks
Users around the world can create games and other interactive programs for this platform. However, then how to create an application for Windows Phone, as well as the possibility, few people know. It should be understood that this is a very complex and time-consuming process, and in order to master the development, you will need to first sign up for special training for a long time.
What does someone who is just about to start mastering the creation of games and applications on WP need to know? Our article is devoted to the sequence of actions that the development process includes, the features of creating a user interface, as well as directly using the capabilities of the platform itself.
The sequence of developing applications for Windows Phone and the features of creating its user interface
The development of any application should always start with making a good impression. In other words, you will need to create a good user interface (otherwise known as XAML) that looks clear and attractive, and then start adding features. The third stage will be testing the application.
Before you design a user interface, you'll need to learn how to choose between surfaces for your program (you can find them through the Windows Store), create a layout, and add content and necessary controls. Be sure to download design resources from the Store.
So, the process of creating an interface begins with creating a layout. You can use a variety of surfaces, such as dialog boxes or various pop-up elements. Depending on what elements are used, the application will be simple and understandable, or complex. Any Windows application also uses a special set of buttons (such as “Send”, “Search”, “Options”, etc.), which, in contrast, is probably familiar to everyone.
If there are errors in the application, you can find out about them through one of three main surfaces. An error message is displayed.
Any application also needs controls, such as drop-down lists or buttons. All of them can be used thanks to special programs from Windows Store(for example, in Visual Basic or C++), and they are also used when creating an interface.
In order for a developer to test his application on a real mobile device, he will need an unlock.
Using the Windows Phone Platform to Create Applications
At the very first acquaintance with the WP platform, the user must certainly make sure that he has not only the necessary knowledge, but also special tools. This may include, for example, Windows package Phone SDK (easy to download from the App Hub website), Visual Studio 2010 (Professional edition or higher), XNA Game Studio 4.0 software environment, Expression Blend visual interactive designer (for WP), Windows Phone Emulator and other additional tools.
Before you begin to understand how to create an application for Windows Phone, you need to carefully study all the main features of this platform - in particular, its controls (WebBrowser and Map), selection and launch tasks (Choosers and Launchers, respectively), and work with an accelerometer and geolocation system. Certain geolocation services are available on your mobile device, which use information received via Wi-Fi, GPS and cellular communications.
Besides software capabilities, the developer also has access to the hardware capabilities of the platform. Having created the ExploreMapControl geolocation application, the user will be able to add accelerometer functions to it by specifying the correct directive.
Before we begin exploring the platform's capabilities and developing applications, we need to make sure that we have all the necessary tools and understand some development basics.
Tools
Visual Studio 2010
To develop for Windows Phone you will need Visual Studio 2010 with Service Pack 1 Professional edition or higher. If you don't have Visual Studio 2010, installing the Windows Phone Development Tools will automatically install the free version of Visual Studio 2010 Express for Windows Phone, on which you can also develop applications for Windows Phone.
Both versions of Visual Studio Integrated Development Tools provide the developer with the same on-device and emulator debugging capabilities that desktop app developers have on Windows.
Please note that in order to debug on the device, in addition to the device itself and the cable for connecting to the computer, you must have the Zune software (http://zune.net) installed on the computer with the development tools. Also, before deploying the application and debugging, you need to register the device (“unlock” it) using Windows utility Phone Developer Registration Tool, which is installed with the Windows Phone SDK.
Windows Phone SDK
This package, available for download on the App Hub website http://create.msdn.com, contains everything you need to start developing. At the time of writing this article, latest version The toolkit is available in Windows Phone SDK 7.1 Release Candidate in the “Go Live” license with the ability to develop your own applications and publish them in the Windows Phone Marketplace. Windows Phone SDK 7.1 Release Candidate contains the following components:
- Windows Phone SDK 7.1
- Windows Phone Emulator
- Windows Phone SDK 7.1 Assemblies
- Silverlight 4 SDK and DRT
- Windows Phone SDK 7.1 Extensions for XNA Game Studio 4.0
- Expression Blend SDK for Windows Phone 7
- Expression Blend SDK for Windows Phone OS 7.1
- WCF Data Services Client for Windows Phone
- Microsoft Advertising SDK for Windows Phone
If you do not have Visual Studio 2010 Professional edition, Expression Bland 4, or XNA Game Studio 4.0 installed, the installation process will also download and install:
- Visual Studio 2010 Express for Windows Phone
- Expression Blend 4 for Windows Phone
- XNA Game Studio 4.0
Expression Blend and Expression Blend for Windows Phone
Expression Blend is an interactive visual designer for XAML, the interface description technology for Silverlight and Windows Presentation Foundation (WPF) applications. It's a great development tool that allows you to easily manipulate layers, animations, styles, and templates. This is a basic XAML development tool. Expression Blend itself is not free, but special version to create application designs for Windows Phone called Expression Blend 4 for Windows Phone is available to developers free of charge. It will be downloaded and installed during the Windows Phone SDK installation process, if you do not have it on your computer full version Expression Blend. You can read more about Expression Blend 4 on MSDN:
XNA Game Studio 4.0
Windows Phone Emulator
Although Windows Phone Emulator does not contain the full set of applications available on a real device, it provides a powerful environment that allows you to develop an application almost entirely in the emulator.
The Windows Phone Emulator does not support playing Zune media content. The emulator only comes with one built-in Internet application Explorer, but it's Internet Explorer 9 with HTML5 support.
At the same time, the emulator allows you to test calls and send SMS messages, supports multi-touch on monitors that support it, supports the simulation of a camera, geolocation services and accelerometer, and will also allow you to take screenshots.
Additional developer tools
Windows Phone Developer Registration Tool
Windows Phone Profiler
Windows Phone Profiler is available in the Debug menu of Visual Studio with the Windows Phone SDK installed.
Silverlight Toolkit for Windows Phone- kit useful elements Silverlight controls for Windows Phone with design mode support, from the Silverlight development team. All source code, examples and documentation are available. Updated approximately every three months, available at http://silverlight.codeplex.com or via NuGet.
The current release includes controls such as ContextMenu, DatePicker and TimePicker, ToggleSwitch, WrapPanel and GestureHelper.
Development environment
After installing the Windows Phone SDK, project groups for Silverlight for Windows Phone will appear in the New Project dialog in Visual Studio:
and projects for Windows Phone will be added to the XNA Game Studio 4.0 group:
This series of articles is focused on development for Windows Phone using Silverlight, so we will look at the templates available to application developers in a little more detail.
After installation, the developer has the following Silverlight for Windows Phone application templates at his disposal:
- Windows Phone Application
- Windows Phone Databound Application
- Windows Phone Class Library
- Windows Phone Silverlight and XNA Application
Before moving directly to application templates, I need to say a few words about Windows Phone and Windows 8-style UI.
Windows Phone and Windows 8-style UI
Windows Phone is not just another platform for mobile devices. It contains not only a technological component, but also a fully developed concept of interface design and user interaction under named Windows 8-style UI or Windows 8-style UI.
If you're a designer or have a dedicated designer on your team, you can take full advantage of the power of Expression Blend 4 or Expression Blend for Windows Phone, which comes with the Windows Phone SDK.
What to do if you are a developer and do not want to deal with the visual design of the application, for example, you are developing a business application and all that is required of it is to comply with the general design and style of Windows Phone?
It's very simple. First, Silverlight for Phone is designed with the Windows 8-style UI in mind, so all built-in controls are designed in the Windows 8-style UI style. Secondly, by default, applications created from templates provided by the Windows Phone SDK work, look, and use styles and fonts in accordance with the Windows 8-style UI.
On the other hand, Silverlight's styling capabilities for XAML-based controls and applications are enough to make your application unique and recognizable while staying within the Windows 8-style UI.
The UI Design and User Experience Guide for Windows Phone can be found at the following link
Everything that was said above relates, of course, to design. regular applications, since the requirements for the design of gaming applications and their interface may differ significantly. At the same time, we must not forget about general principles user experience inherent in the Windows Phone concept.
Application Templates
First, let's look at three templates that represent the three main styles of a Windows Phone app:
- Windows Phone Application
- Windows Phone Pivot Application
- Windows Phone Panorama Application
Windows Phone Application is an analogue of a simple conversational application that has one main screen through which the main interaction with the user occurs.
Windows Phone Pivot Application is a kind of bookmark application, where the title of each bookmark determines the content. The standard use case is that each bookmark represents the same data, but in different views and/or with different filtering. For example, a calendar mail client and phone settings. The template uses a Pivot control.
Windows Phone Panorama Application – a panorama application in which user interaction areas are also divided into panels, but they are accessible through horizontal scrolling; the background image is set to the entire panorama at once, it has a common title that scrolls slower than the panels; the content of the adjacent panel on the right is visible when the current one is displayed. For example, hubs in Windows Phone are implemented in this way: People, Marketplace, Pictures, Music+Videos, etc. The template uses the Panorama control.
Templates ending with Agent are library templates for performing the corresponding background tasks:
- Windows Phone Audio Playback Agent
- Windows Phone Audio Streaming Agent
- Windows Phone Scheduled Task Agent
Windows Phone Databound Application template - a simple application template with a list - a detailed view with the implementation of navigation between pages, passing parameters and storing data in a global ViewModel.
Windows Phone Class Library Template – class library template for Windows Phone.
Windows Phone Silverlight and XNA Application template for a Silverlight application that can use XNA to render graphical content.
Hi all! You've probably already heard the news that in the first 4 weeks More than 75 million people have already installed Windows 10. In this context, we are especially pleased to share with you an introductory article from Arseny Pechenkin from DataArt on how to start developing top ten applications.
For those who doubt whether or not to bet on their favorite Windows machine 10, we offer a short overview of materials about the platform, development tools and new features available when developing applications.
I think everyone already knows where and how to get their copy of Windows 10 - we won’t dwell on this point. Installation is done in the same way Windows installation 8. If you are going to update the system, I strongly recommend that you do backup files from the system disk.
Tools
What development tools can I use? You will need a new MS Visual Studio 2015. Visual Studio 2015 Community Edition and paid Professional and Enterprise editions are currently available.Some time ago, almost all sections on development for Windows 10 led to sections about development for Windows 8.1, but after the release the documentation is gradually updated (taking into account the fact that the UWP platform for Windows 10 is a development of WinRT).
Online course at Microsoft Virtual Academy
For those who prefer an audio-visual format of getting to know the platform, there is an introductory course: A Developer's Guide to Windows 10.The course describes the main features of the platform, models and tools available for creating Windows applications. Several basic scenarios that are implemented in the application are considered: working with a small amount of memory, background execution of tasks, communication between devices, file and data management, and user interaction methods.
License and device unlocking
As with development for Windows 8/8.1, a developer license will be required. It turns out similar to a license Windows developer 8/8.1 when creating your first project directly in Visual Studio (this is not the same as a store publishing account). To install applications on your devices, do not forget to unlock them:Universal Applications
What's new for the developer? It was announced that the universal application can be run on any Windows 10 platform. This is implemented through a system of various APIs. That is, there is an API layer common to all platforms (Universal Windows Platform, UWP). If the application uses only its capabilities, it will work on all platforms with UWP.If you need to use specific platform capabilities (for example, working with hardware buttons on a smartphone), then you can use the corresponding APIs through platform extensions. This functionality will only work on platforms that have these APIs, so checks for the availability of the corresponding methods and classes need to be built into the code.
Templates
Out of the box in Visual Studio, we have access to only one project template, Blank App.This is a Single Page Universal Windows Application project that has no predefined controls or structure.
In addition to the standard template, you can find templates from the developer community.
The collection currently includes the following project templates:
- Blank App, a basic single page XAML project. Similar to the standard Blank App included in the Windows 10 SDK, but without Application Insights telemetry.
- SplitView App, a multi-page application project with adaptive SplitView control.
- Composition App, a project that does not use the standard component library, instead using the Windows.UI.Composition API,
- Composition XAML App, a project using XAML and the Windows.UI.Composition API.
Examples
To make it easier to log into the UWP platform, Microsoft has prepared a growing collection of examples:Developing applications for Windows Phone is not that difficult, especially if you are trying to make an application that provides information about services and products or collects data from RSS feeds.
This is a type of application that can be implemented using javascript code in the browser, or using the Access designer, and therefore, to develop such mobile or desktop applications, you do not necessarily need to acquire a full set of tools. A new generation of application designers has arrived, web services that allow you to create and launch native applications.
Microsoft recently launched its own studio for creating applications - Windows Phone App Studio. This is a simple tool that will allow you to create working applications from scratch. For example, to develop a simple application discussed in the article, you will need less than 15 minutes, since this designer presents standard templates. Of course, we are not talking about developing complex programs or games, but this article will be enough to get you started.
Like Access applications, programs created with Windows Help Phone App Studio uses data connections, meaning they are built on a master/detail view model. You can connect a content feed (be it RSS, Youtube, etc.), or use it to publish your own content. Of course, the application is capable of both at the same time. In addition to feeds, you will also have the opportunity to post your own content, be it compiled HTML pages or pages organized using simple bases data that Microsoft calls “collections”.
1. On the first step, you need to decide on the content of your application, you can edit or delete those pages and elements that are by default.
We linked our test application to the great-world RSS feed. All we need is the feed URL and the builder will automatically create a viewport that displays a list of recent articles, as well as a second viewport displaying detailed information about the articles.
However, it is worth noting that the process of creating your own application is not so simple, since the RSS parser used in App Studio sometimes cannot cope with the formatting of the RSS feeds generated by the site. That is, sometimes this can become a real problem, because the text of the article simply will not be displayed, and the ability to debug will be severely limited, as is the case with any cloud development tools.
3. Now, you will need to set title, description, and also set it to 160x160 pixels.
4. Well, the final stage - generation and publication applications. Here's what we got:
At the end, a preview of the created application is available, you can check how it will work on a smartphone or tablet. If everything is fine, click the “Generate” button, a pop-up window will appear:
There are two options to choose from, the first is to generate an application for mobile devices, the second is for tablets and regular PCs. The service takes less than 10 minutes to generate, so you can make a product for each platform in turn. The installation process is very simple thanks to the built-in support for QR codes in Windows Phone. First, you need to install a certificate on your phone, and this is done using a QR code that allows you to download the certificate directly to your phone.
- To put the resulting miracle on the Windows Phone Store i.e. to the application store, so that anyone, not just you, can download it, you need a developer certificate. It costs about 600 rubles.
It is immediately obvious that this tool is aimed at BYODev scenarios - when you need to quickly get an application without getting involved in a full-fledged development process. Although it is worth noting that you still have the opportunity to download ready-made source codes and use this tool for prototyping before giving them to the development team for revision. You will certainly be able to independently link data sources in the form of collections hosted in the cloud.
This is one of the good reasons why Microsoft allows you to download source code that is ready to run in Visual Studio. It will be packaged into a Visual Studio project and can be imported directly into the desktop IDE and then debugged. Debugging the application using your favorite device simulator will help you quickly identify the problem - the image inserted at the beginning of the article was deleted on the server. You can quickly change the code and the application will work again.
In addition to making debugging easier, access to source code also makes it easier to style the generated code, either by changing templates or by changing data source connections to personal sources. The generated code is all commented and, since it is used as the main development design pattern when creating applications, it will be much easier for you to understand exactly how each individual piece of code works and how to adapt it to your requirements.
One thing is clear about creating such applications: they are not designed for creating complex applications. They are like plastic toys for children: everything is in front of us, and we just have to put something together with meaning. As you gain experience through these types of playgrounds, you can gradually move on to formatting the code and use it to create more complex things. With toolkits like Windows Phone App Studio, you can gain specific experience with content-driven apps, RSS feeds, web content, and local content.
Of course, this kit probably doesn't represent everything you'll need to create a commercial application, no matter how simple it might be. But that's not the point, because the generated code gives you a framework to work with, as well as the ability to understand how the application creation process works. One thing is for sure: if you are planning to start developing your own applications, then this is a great place to start. Read further: and?