Your app for Windows Phone? Easily! How to create your first Windows Phone app. Example of development on the designer of Microsoft App Studio How to create an application for windows 10
There is an opinion that in real life smartphones with Microsoft OS are as common as people with the patronymic "Artyomovich". The strange (to put it mildly) policy of the "Evil Corporation" regarding the seventh and eighth families of the mobile operating system turned away many users from experimenting with "windows" for smartphones, and now the corporation has seriously taken up correcting its image in this user niche. As an underground fan of Microsoft, I hope that they will succeed - the "ten" is walking around the planet, its main trump card is one core for all platforms, and therefore it has every chance to pull over a good part of the mobile market. And as a programmer, I will be happy to make an introductory article for you on developing for this mobile axis, so that you are always ready for the growth of its popularity :).
Architecture overview
With a common core and runtime for UWP apps, an app once written 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. In addition, UWP is not limited only to the execution of 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 it is intended given driver, the same.
UWP supports both kernel-level and user-level drivers. The subsystem includes the Device Driver Interface (DDI) interfaces that 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 apps for Windows 10 Mobile, you'll need Visual Studio 2015 (no doubt). The third update came out this summer. I strongly recommend! Its main bugfix is the reduced memory consumption compared to the second update.
Also you will need Windows 10 Anniversary Update SDK: it includes everything necessary tools to develop applications for the entire fleet of devices running on 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 simplifies the implementation of voice control. The Cortana Actions component in the new API allows you to create new phrases/expressions.
Biometric windows authentication Hello is now available to web developers in the Edge browser.
The Blend for Visual Studio 2015 user interface modeling tool provides more advanced interface building capabilities than VS. With it, you can create layouts in XAML for all supported applications: application, web, universal, mobile, and so on. It also contains constructors for additional tasks, such as creating animations and controlling the behavior of elements.
Ways to create apps for Windows 10 Mobile
The main way to create applications for Windows 10 Mobile smartphones is to develop universal (UWP) apps(scroll Visual C# → Windows → Universal project creation wizards).
However, he is not the only one. As you know, Xamarin is built into Visual Studio 2015, it can also be used to create applications for Windows 10 Mobile, both 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, it can equally be selected Visual Basic or Visual C++. VS 2015 allows you to create universal apps with JavaScript(JavaScript → Windows → Universal Applications). They can also be deployed to a Windows 10 Mobile device.
Tools for working with legacy projects
For a long history of operating Windows systems a huge number of different applications have been created for it. With the release of Windows 8 and WinRT (and later Windows 10 and UWP), old desktop applications are a thing of the past, as only Win 8 and Win 10 desktop applications 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. Born from this Desktop App Converter.
Converting an Xcode project is a two-step process. First you need to add Objective-C syntax highlighting to 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 an Xcode project to a VS project. After that, 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 and it will run just like any other Windows program.
Break me down, how amazing it is to see correctly highlighted Objective-C code in Visual Studio!
A free compiler is used to compile Obj-C code Clang. Since the output is a standard UWP app, it can be run on a mobile device in Windows environment 10 Mobile. One program can have both C++ and Obj-C code.
If you have a project for a 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 so that it meets the requirements of the universal Windows applications(UWP). Not only markup will be converted user interface in XAML, but also program logic in JS/C++/C#/VB. 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 through the 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 project ANGLE . ANGLE (Almost Native Graphics Layer Engine) - almost native graphics layer engine - allows Windows users run OpenGL ES applications seamlessly on DirectX 11 hardware. 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 apps for desktop Windows desktop(Windows desktop applications).
The issue is discussed in more detail in my book “ The magic of the moment of rotation"(Again you are promoting your book! Well, okay, you deserve it. - Approx. ed.).
Continued available to members only
Option 1. Join the "site" community to read all the materials on the site
Membership in the community during the specified period will give you access to ALL Hacker materials, increase your personal cumulative discount and allow you to accumulate a professional Xakep Score rating!
Last update: 31.10.2015
Let's start Visual Studio Express 2013 for Windows. Select File->New Project... from the menu. The project creation window will open in front of us:
On the left side of the window, select Visual C#->Store Apps->Windows Phone Apps. And among the templates of the new project, select Blank App (Windows Phone) , give some name to the project, for example, let's call it HelloApp. And click OK.
And Visual Studio will create a new project:
The Blank App template project has the following nodes by default:
The Assets directory containing the image files used
App.xaml and App.xaml.cs - xaml application resource file and c# application code file, respectively
MainPage.xaml and MainPage.xaml.cs - application window GUI file and window code file in c#, respectively
Package.appxmanifest - application manifest file
On this initial stage while files are of value to us MainPage.xaml And MainPage.xaml.cs. Let's open the MainPage.xaml file, which represents the GUI:
On the left, in the form of a phone, we will have a graphic designer window. On the right is the graphical interface markup window in xaml. The graphical interface in this case is represented by the MainPage class, which is a separate page. All interface changes that we make will immediately be displayed in graphic designer, which will give us a visual understanding of how everything will look in the end.
Let's say our application will calculate the amount of the deposit after interest is calculated. To do this, we need a field for entering the amount of the contribution, a field for displaying the result and a button with which we will initiate the calculation of the final amount. So let's change the file code MainPage.xaml in the following way:
We use element attributes to set them. appearance and positioning. For example, using the Margin attribute, indents from the outer edge are set. We will talk more about attributes and other elements of the xaml language later.
After adding elements and their attributes, the designer window will be automatically updated:
Now let's change the button code as follows:
Using the expression Click="button1_Click" we added a handler Click events. Thus, when the button is clicked, the button1_Click method will be triggered. Now let's define this method.
Let's open the file MainPage.xaml.cs, which contains the page's logic. By default it has the following code:
Using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace HelloApp ( public sealed partial class MainPage: Page ( public MainPage() ( this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; ) protected override void OnNavigatedTo(NavigationEventArgs e) ( ) ) )
Add a new method to the MainPage class:
Private void button1_Click(object sender, RoutedEventArgs e) ( double capital; if(Double.TryParse(textBox1.Text,out capital)) ( capital+=capital * 0.12; textBlock1.Text = capital.ToString() + " dollars"; ) else ( textBlock1.Text="Incorrect value"; ) )
In the method, we get the value entered in the text field and try to convert it to the double type. If the transformation is successful, then we display the result of simple calculations.
Let's run:
At launch, we can choose where we will test the application - on a real device or an emulator. In my case, I'm running the application on a real smartphone, so I select Device from the dropdown list. However, you can also select one of the emulators if they are already installed.
When launching an application on a smartphone, it is important that the smartphone is not in a locked state. So let's run:
Enter a number in the text field and click on the button:
When testing via a smartphone, it is important to remember that when you start the application is automatically installed on the phone, and we can find it in the list of all applications:
And if necessary, then, disconnecting from the computer, we can also start it or delete it.
This completes the creation of the first application.
Hello!
My last post was written a long time ago and it's time to correct this unfortunate fact. Today I decided to dilute a series of articles about Windows Azure and talk about another, no less attractive platform from Microsoft - Windows Phone.
As you probably already know, the operating system for mobile devices Microsoft has been on the market for a long time (since 2010) and today it occupies one of the leading positions, in some countries bypassing even the popular iOS in terms of the number of devices sold. Therefore, many developers both in Russia and around the world are already writing applications for this OS with might and main, reporting on excellent sales and profits in the Windows Store.
Getting started developing apps for Windows Phone is actually pretty easy. If you already know C# and have experience with WPF or Silverlight, then you can say that you know 80% of the information you need. The fact is that the development platform for Windows Phone was originally based on Silverlight, and in the WP8 version it was replaced by a platform somewhat similar to it, albeit closer to WinRT. So if you have ever written applications in WPF, you know what MVVM is and what it is for, then go ahead, write applications for Windows Phone.
But what if you are not an experienced developer, but you really want to have your own unique application here and now that you can install on your phone and brag to your friends? This will be discussed in today's article.
Windows Phone App Studio
I have always loved Microsoft for providing its developers with a very handy tools for work. And in August, Microsoft introduced its new service, which will allow anyone, even not familiar with programming in general, to create their own application for Windows Phone. It's called Windows Phone App Studio.
Via this service you can create a complete application from scratch in just four steps. You can set your own styles, images and data, add a description and put the result in the app store. However, you do not need to be a registered developer (annual subscription for which costs $99). Now everyone can unlock one device for free and download up to two of their own apps to test them out.
I myself became interested in what opportunities this service has, and I decided to create a satellite application for my mini-project Programming Facts. I will talk about this in detail now.
Step 0.1. registration
In order to start using the service, you need to register your own LiveID account. I think it makes no sense to explain what it is if you have ever used any service from Microsoft. We go to the App Studio website and click the Start Building button:
Enter your LiveID login and password and you will be taken to the system for managing your applications. If you are doing this for the first time, then you will have an empty list. I already have the prog_facts application in my collection.
Step 0.2. Application type selection
To create your first application, select the Create menu item. You will be offered two options - create an application using one of the available templates, or set everything up from scratch.
There are a lot of ready-made templates. Among them are templates for sports applications (for example, for tracking the results of your favorite team), family, entertainment, and many others. When you hover over the template, you will see it short description, and when you select each of them, an additional window will open for you, where you will be shown how this application might look like.
In my case, I decided not to rely on a template, but created an application from scratch by selecting the appropriate menu item create an empty app.
Step 1App Information
The very first and easiest step of the four steps for which we are promised to create an application is responsible for information about the future application. You will need to specify its name, a short description and choose a logo. The logo must be in PNG format and 160×160 pixels in size.
Pay attention to the phone that is displayed on the right. It always displays your application with the changes you make to it.
Step 2. Filling with content
Every app created through Windows Phone App Studio is made up of sections. Each section is a set of pages linked by some kind of logic. For example, the data that can be displayed on this page. Let's create a new section in which we will use an RSS feed as a data source.
Here you need to specify the name of the future section, select the type of data source (collection, RSS, YouTube videos, Flickr images, Bing search and HTML5 content are available) and give it a name. After creating the section, we will get to the editing page.
The editing page is divided into several parts. In the Data Source section, you can manage the data source associated with this section. The Pages section contains a list of all the pages that belong to the section. You may notice that we have two pages created by default. The first one, called Blog, is the main page of the section, which contains entries read from the RSS feed. The second Info page has been generated automatically and is responsible for displaying the details of each RSS entry when the user selects it from the list. We'll leave the section pages for now and edit the data source first. (and do not forget to click Save Changes so that the section is saved in the project)
Step 2.1. Data source
Having selected the data source on the previous screen, we will get into its editing window. Since we have chosen the RSS source type, we will be prompted to specify the URL from which the data will be received. For this example, we will use the RSS feed located at
Once you click Refresh and save the results, home page application in the emulator, you will immediately see that the data from the RSS feed is already displayed in your application. This is extremely convenient and useful, because you can immediately find out how the program will look like. For example, my RSS feed doesn't attach images to posts, so the App Studio builder substitutes default images instead, which look out of place. Let's fix this.
Step 2.2. Editing the Page Appearance
Selecting one of the pages on the “Configure App Content” page in the Section Pages section will take you to its editing window. There are several possible templates available for each page type. The Blog page that I initially want to fix has the post and image view set to default. Let's choose a post-only view, adjusting the page title along the way:
You can immediately see how the application has changed. Now the entries go one after the other in sequence, which brings the appearance of the application to a minimalist style. Pay attention to the Item Title and Item Subtitle fields. Instead of plain text, obscure expressions (Data.Title) and (Data.Summary) are now written there. For those familiar with WPF, this can be compared to Data Binding. For the rest I will explain.
Since our section is built around the Data Source, we must be able to somehow get data from this source. These expressions just mean that in the corresponding fields we want to see information received from the RSS feed. Here, the Data object represents a single RSS entry, and the Title and Summary fields represent some specific part of that entry. If you click on the icon to the right of the field, then you will see the entire list of available fields of the Data object, including information about the author of the entry, its date, link, and a few more.
Let's try to edit the Info page in the same way. A slightly different set of templates is available for it, among which we will choose the simplest and most suitable one:
This page is about the same. The only thing is that instead of the Data object, Context is used here, which is essentially the same.
Step 2.3. Adding menus and other sections
In addition to simple sections, you can add a so-called menu to Windows Phone App Studio. This is a section that consists of a list of links to other sections or external sites. I decided to add a menu to the video sections of the site so that you always have quick access to useful information. The menu is added similarly to a simple section and its configuration is not difficult. So I propose to master this as homework.
Step 3 Styles
Having completed filling the application with sections, pages and menus, we move on to talking about beauty, namely style. In section 3 “Configure App Style” you will be able to configure the base color scheme that will be used in your application. I chose the colors that are used in the blog - it's blue and white. Thus, the application turned out to be bright and pleasant, although there is no dispute about tastes.
The Accent Brush color is responsible for what your main accent color will be. It is responsible for the title of the application. The Background Brush, as you might guess, is responsible for the background color. You can also choose a picture if you think it's more appropriate than a solid color fill. Foreground Brush is the color of the fonts that will be used to display data in your application. Well, the Application Bar Brush is the background color of the menu bar displayed below.
Step 3.1. Tiles
Tiles are an essential part of any Windows Phone application. They can extend your application by allowing the user to see additional information without opening the main program window. Of course, in Windows Phone App Studio you won't be able to create a smart tile that could independently update its view and load additional data from somewhere. However, you can choose from several standard types behavior using some static data. For example, for the glamcoder application, I chose the Iconic Template tile type and display a brief description of the application on it:
Step 3.2. Splash and Lock Screens
These are additional decorations that will make your application look more elegant and presentable. The Splash Screen image is the picture that is displayed to the user while your app is loading. There, as a rule, it is customary to place the logo of your program or company in order to immediately make it clear to the user which application he is going to use at the moment.
Image for Lock Screen - this is the picture that will be displayed on the lock screen. Actually, it doesn't make much practical sense, because this picture is static within Windows Phone App Studio, and it is unlikely that the user will want to replace the colorful Bing wallpaper with your picture.
Step 4. Final
Well, we have reached the very last stage - the creation of our first application for Windows Phone. On the last page with the name Generate, a treasured option awaits us - to generate a package that we can later install on our device. Press the big Generate app button and wait for the magic to work.
After the generation is completed, you will see a corresponding message, as well as several options to choose from. First, you will receive an email from which you can download your application. The second is that you can download the finished package file to your computer in order to publish it later in the app store. And the third option - you can download source codes received application to edit them. I advise you to use the third method. First, it gives you more flexibility and allows you to make changes that you can't do in Windows Phone App Studio. And secondly, and most importantly, you will be able to independently understand the application code, learn how it works, so that next time you can write everything with your own hands.
Conclusion
The popularity of a particular mobile operating system today is determined not by the functions that it provides users out of the box itself, but by the applications that are available in the store and which allow you to expand the functionality of each device to infinity. I often hear people who are not very familiar with Windows Phone say that it is a backward system, that there are no necessary applications for it, and similar nonsense. All this is not true. The system is actively developing, every day there are more and more new, useful, and sometimes even exclusive applications.
I really hope this article inspires you to write your very first Windows Phone app. And I want to believe that the knowledge you gain will help you create a new Instagram or new Angry Birds. And to make this happen as soon as possible, go to the development portal for Windows Phone, study materials, watch video tutorials, create.
Good luck and good applications!
Last update: 04/12/2017
UWP (Universal Windows Platform) is a unified platform for building and running apps on Windows 10 and Windows 10 Mobile.
UWP is the result of a foliation of earlier technologies. So, with the release of Windows 8, a new architectural platform for applications was introduced - Windows Runtime (WinRT), which allowed running applications in the so-called Modern (Metro) mode on desktops and tablets. Then, with the release of Windows 8.1 and Windows Phone 8.1, this technology was developed - there were "universal applications" that could run immediately Windows 8.1 and WP8.1. And in July 2015, the new Windows 10 OS was officially released. It uses the UWP platform, which is windows development runtime.
As the name of the platform suggests, it is universal - universal for all devices in the Windows 10 ecosystem. And these are ordinary desktops, tablets, mobile devices, IoT devices (Internet of Things), Xbox, Surface Hub devices. And a UWP app can run the same on all of these platforms as long as they have Windows 10 installed.
Why UWP?
Programming under UWP has a number of advantages:
Distribution breadth. To date (April 2017), Windows 10 has already been installed on more than 400 million devices. On desktops, Windows 10 is already ahead of Windows 8/8.1.
Support for a wide range of devices. Desktops, tablets, smartphones, large Surface Hub tablets, various IoT devices, HoloLens virtual reality devices in the future - the range of devices that Windows 10 can run on is really wide.
Support for different programming languages and technologies. UWP apps can be built using languages such as Visual C++, C#, Visual Basic, JavaScript. Visual C++, C#, and Visual Basic use XAML as a technology for creating a graphical interface; JavaScript uses HTML. Also, C++ can use DirectX instead of XAML. That is, quite common and familiar to many technologies.
App store and ease of distribution. The Windows Store is a great place to distribute UWP apps, both paid and free. The capabilities of the platform and Windows Store Store allow you to use different ways of monetization. For example, you can integrate ad blocks into applications through various SDKs. You can distribute for a fee, and the payment can be flexibly configured. Optionally, you can embed the provision of a trial version, after which the user can decide whether to buy the application or not. And you can also monetize according to the freemium model, in which the application is shareware, and certain services within the application are provided for a fee. Moreover, all these monetization opportunities are provided by the built-in SDK tools.
Rich platform features. UWP inherits a lot from Windows Runtime from Windows 8.1 and at the same time provides many new features like richer cloud integration, Cortana, Win10 notification system and more.
What you need for UWP development
UWP programming requires Windows 10. All others Operating Systems like Windows 8.1/8/7, not to mention Windows XP, do not fit !
You will also need the Visual Studio 2017 Community development environment. This is a fully functional free development environment that can be downloaded from the official website at https://www.visualstudio.com/downloads/download-visual-studio-vs .
It is also possible to use the VS 2015 version and all other previous versions Visual Studio - 2013, 2012, 2010 etc. do not work with UWP.
When installing Visual Studio 2017, the appropriate item must be checked in the installer program:
Before you start creating apps, make sure that the appropriate option for developers is installed in Windows 10 Update:
And with Windows 10 and Visual Studio 2017 installed, you can start developing applications.
Japan was more than noticeably affected by the outcome of World War II. In 1946, the government froze all personal deposits of the population and introduced cards for many types of goods, including food. Two years later, the American authorities decided...
Such machines are sold in Russian Federation, despite the fact that, unlike in other countries, here their owners do not receive tax benefits. Our compatriots for the most part treat such “fashionable things” with coolness, nevertheless, BMW is in ...
In 1927, Giovanni Agusta died, leaving the new venture to his wife Gussepina and 20-year-old son Domenico. The young count was fond of motorcycles. And when, by the end of World War II, it became clear that in Italy the aviation industry alone would ...
It would seem that Ducati and chopper are completely incompatible things. But after all someone same rides on cruisers! And there are many such people. And grandmas for such tales, therefore, they spread - God forbid how much! So, to give at the mercy of competitors this entire segment ...
Jujiro Matsuda opened the forge twice, but the circumstances were such that the business had to be closed. Only in 1920, Matsuda, with a group of investors, acquired in Hiroshima the bankrupt construction company Abemaki, which was engaged in the sale of...
But there are still exceptions to the rule. Toyota Land Cruiser Prado 2002 model year, with its "urban" style, is able to overcome even serious impassability. The combination of the words "Land" and "Cruiser" alone allows us to classify the model as a combination of ...
Events - Subaru Impreza WRX
Created to impress The name Impreza comes from the English word impress, which means "to impress", "to impress". And the addition of WRX suggests that this is one of the highest modifications of the Subaru Impreza model. For the first time, she was...
In December 1887, a boy was born into a peasant family near Milan, who from childhood was interested not so much in rural labor as in then fashionable equipment with gasoline engines. At the age of 15, Giuseppe Gilera (and it was he) got a job at ...
She was the first in Japan to receive a multiport fuel injection system. There was also a diesel-powered variant, which became the world's first such car in the Gran Turismo class. Today, this machine is a real classic and a subject of...
White stripe - black, and again white - black. Up-down, up-down. This is not an attraction in the Luna Park, but the life of one of the best Formula 1 racers. September 17, 1960 in London in the family of the future two-time Formula 1 world champion Gr...
But Suzuki wasn't always a motor company. It all started prosaically and very much in the spirit of minimalist Japan. In the small godforsaken village of Hamamatsu in Shizuoka Prefecture (the same one where Soichiro Honda, the founder of another...
As it turned out, they have similar views, so they immediately began to cooperate. Volvo's birthday is April 14, 1927, the day the first car called Jacob left the factory in Gothenburg. This event marked the birth of a new Swedish...
Mechanics Johann Winkelhofer and Richard Jenicke in February 1885, under the brand name Wanderer, began producing bicycles of their own, original design, which became very popular. As a result of the widespread motorization in 1902, first...
Renault F1 Team. Parallel - converge! French line, broken
In the early days of Formula 1, the circuits were dominated by car corporations. Alfa Romeo, Maserati, Ferrari - no one doubted that their cars would be favorites. Then some factory teams left the Royal Races, in return for ...
The history of the brand, or why cars with the nameplate "TRD" cannot be considered ordinary "Toyotas" on June 7, 1954, when neither Corolla nor Crown were in the "arsenal" of the young and unknown company outside of Japan, Toyota, and Land Cruiser did not even think acquire...