Hi all!
I present to your attention a new tool from Microsoft "Windows App Studio»
- a designer for creating applications. Today I will tell you how to the average user it became possible to create applications for Windows and Windows Phone. And a little about how this tool can be useful to a developer.
App Studio is a tool designed for creating content applications. This type of application provides the user with topical information, various catalogs and a whole range of other standard functions.
App Studio interacts with the user through a web interface, works on any browser and is available at the following link. All App Studio data is stored in the cloud.
To access App Studio, you must have a Microsoft account (formerly Live ID) and Internet access.
Review
The interface is simple and intuitive:On home page There is a control panel for accessing the main pages of the resource:
The main page also demonstrates applications created in App Studio, functioning and available in the Windows Store:
Templates
To create an application, App studio offers the following scenarios:- Use templates;
- Create an application from scratch.
Unlike other templates, Empty App does not offer any script for creating applications and is completely free of content.
All App Studio templates provide the ability to create universal applications available on Windows and Windows Phone 8.1 devices. In addition to the Web App template:
The purpose of this template is to remake mobile version website to the Web App using the site URL. This feature is only available for Windows Phone applications.
It is worth noting the variety of App Studio templates and the presence of thematic components in each of them:
Creating an application
The application creation cycle in App Studio consists of 4 stages:- Search for an idea;
- Filling content;
- Style design;
- Using a ready-made application;
The start page for the new Empty App looks like this:
The work area is divided into four parts:
- Work on the structure and content of the application: Content;
- Next two tabs are responsible for appearance and application style: Themes And Tiles.
- Publish info contains preliminary settings for publishing an application in the Windows Store.
Working on content
In the Content area, we determine which pages Wine Expert will consist of:- About wine;
- Wine catalogue;
- Wine production;
- About the creators.
Design and style of the application
App studio in the Themes tab offers to configure the application theme:
- Standard: dark, light background;
- The user's preferred background, including the option to set the image as the "Background Image".
The Tiles tab designates the appearance of the application on the start screen, background image and background screensaver:
Let's set up the application tile on the start screen:
- Flip template– living tiles;
- Cycle template– scrolling through the specified collection from the application;
- Iconic template– one image of all three tile sizes.
In the left top corner There is also an area for loading a picture, which will be displayed next to the application name, let’s fill it in too:
On the Splash&Lock tab we will perform the same actions with images:
Save the changes and move on to the next step.
Setting up an app to publish to the Windows Store
Let’s look at what data “Publish info” requires from us to prepare for publishing an application in the Windows Store, in addition to the understandable App title, App description and Language:
One of the conditions for publishing an application in the Windows Store is that the application name (App Name) be reserved in the store before publishing it. We reserve the application name in the Development Center. The store will assign its own “Package Identity” to each reserved (registered) name. The App Studio user needs to know this information, name and ID.
In order for App Studio to generate a special application package for publication, you must fill out the “Application manifest” - the application manifest. To do this, the following “Associate App with the Store” setting is provided in “Publish Info”:
The final stage of working with the application
The application is ready - click “Finish”:We get the ability to preview the application for any device.
The “Generate” function suggests choosing for which platform you want to generate the application, select Windows Phone 8.1 and Windows 8.1, which will allow you to create a new type of application - universal:
In the “Generation type” field, note that we need an application package for installation on the device and a package for publishing. The application source code is generated by default.
So, now we can download all the materials provided by App Studio to work with the created application.
Installing the application on your device
An application created using App Studio can be installed on a device directly, outside of the Windows Store, thanks to the generated “Installable packages”.What is needed for this:
- Install a certificate on the device:
- Download the installation package provided in App Studio for the certificate depending on the device (PC, tablet, phone);
- Run the file with the .cer extension (when installing, select Local machine, Place all certificates in the following store: Trusted Root certification Authorities).
- Install the application on your device:
- Download Installable packages;
- Find the file Add-AppDevPackage1.ps1, right-click and launch “Run with PowerShell”.
Access application data in the cloud
To add, delete, or edit dynamic data for a published application, you need to go to the corresponding application in the Dashboard list in the Dev Center. Open the collection and make all necessary changes. The application will update automatically.Developer Features
App Studio can be useful for a professional developer by providing the source code of the application.It can also be convenient for a developer to create the structure of his application using this tool, and then use Visual Studio 2013 (Update 2) to refine it without wasting time on writing basic elements.
Conclusion
In order to create an application in App Studio, no programming knowledge is required, in addition to creating the application and receiving it source code absolutely free.Developers will also be interested in using the new tool, for example, to reduce the time for developing the basic structure of the application.
Creating a Windowed Visual Studio Application
Introduction to Creating Windowed Applications
API functions for working with the console
Window Application Structure
Window Controls
Graphics in windowed applications
In the Windows operating system, 3 types of program structures are possible:
- dialog (main window - dialog),
- cantilever or windowless structure,
- classic (window, frame) structure
Conversational applications for Windows have a minimal user interface and transmit information to the user through standard dialog boxes (for example, the MessageBox() message box). The program works “blindly”.
Non-window (console) applications is a program that runs in text mode. The operation of the console application resembles the operation of an MS-DOS program. But this is only an external impression. The console application is provided with special Windows functions. Console applications are a system of means for user interaction with a computer, based on the use of text (alphanumeric) display mode or similar (MS-DOS command line, Far). Console applications are very compact, not only in compiled form, but also in text form, and have the same ability to access Windows resources through API functions as window applications.
Window (frame) applications are built on the basis of a special set of API functions that make up the graphical user interface (GUI, Graphic User Interface). The main element of such an application is the window. A window can contain control elements: buttons, lists, editing windows, etc. These elements, in fact, are also windows, but with special properties. Events that occur with these elements (and the window itself) result in messages being sent to the window procedure.
The difference between windowed and console Windows applications is what type of information they work with.
In the New Project Visual Studio dialog, select Visual C#, Silverlight for Windows Phone and a simple Windows Phone Application template and call it ExploringXAMLFeatures.
In the target selection dialog operating system select Windows Phone OS 7.1
After creating the project, the Visual Studio window will look like this:
Let's look at the project structure in the Solution Explorer window:
File name | Purpose |
AppManifest.xml | The manifest file required to generate the XAP file into which the application is packaged for deployment on the phone. |
AssemblyInfo.cs | Another configuration file that defines some metadata of the main Assembly of the application. |
WMAppManifest.xml | A metadata file that contains various application settings: title, setting the first page, paths to icons, defining the necessary system capabilities etc. |
App.xaml | This is the application resource file. Global resources (this will be discussed when using styles) or global events (occurring when the application starts) are located here. This file is also the application's entry point. |
App.xaml.cs | Code file (code-behind) for App.xaml. Here you can handle application-level events and errors, including application tombstoning. This concept will be discussed later when multitasking is discussed. |
ApplicationIcon.png | A picture that will be the application icon on the phone. This is a really important file as it is the first thing that users will see when working with the application. |
Background.png | This image is used when the application is pinned to the phone's start screen. This is essentially a large application icon. It makes sense to make it visually similar to ApplicationIcon.png. |
MainPage.xaml | This is part of the selected application template. MainPaige is not a very good name, but it is what the default project template uses. This page represents the interface that the user sees when starting the application. |
MainPage.xaml.cs | MainPage.xaml page code file. |
SplashScreenImage.jpg | This picture is displayed while the application is loading. You can set your own picture with animation to inform that the application is loading. There is a technique for creating very dynamic loading pages in XNA, but it is well beyond the scope of this article series. |
XAML files define the application's interface. In fact it's simple XML files with XAML markup language.
Although this is the simplest project, it contains all the key elements that all other templates and project types contain.
Please note that some of the settings presented in the form configuration files, can be edited in the visual interface for editing application settings.
Adding controls to a XAML page
Note that Visual Studio renders both the design and XAML of the page by default.
If you navigated to other solution files, double-click on the MainPage.xaml file.
In the XAML code of the MainPage.xaml file, inside a Grid element named ContentPanel, insert a Button control:
In the design window, the button will appear immediately approximately in the center of the interface. Pay attention to the attribute Name? This is the element's unique identifier, which helps you reference it in code. Think of this as the ID attribute of the control. Let's now add some action when this button is clicked. There are two ways to bind an event to a Button (or any other control). In XAML, right in the Button definition, we can add a Click attribute and InteliSense will automatically ask if we want to generate a new event handler:
You can bind the event handler directly in the Home.xaml.cs page code without specifying it in the XAML file:
Public MainPage() ( InitializeComponent(); MyButton.Click +=new RoutedEventHandler(MyButton_Click); )
Both methods work. You can use any of them. For simplicity, we'll use the XAML method definition here. You can now write managed code in the MyButton_Click function that will change the interface or call other functions. Let's complete our example application by adding code that will change the text in the TextBlock PageTitle (PageTitle is a Name, so you can reference it directly in code) to "hello wp7". To do this, add the following code to the function:
Private void MyButton_Click(object sender, RoutedEventArgs e) ( PageTitle.Text = "hello wp7"; )
Select in the project settings Windows Device Emulator
And launch the application by clicking on the green triangle or the F5 button. After launching the application and clicking on the “Press Me” button, the screen should look similar to the screenshot below:
Adding new pages to a project
Only the simplest application consists of one page. We want to learn how to write complex multi-page applications. We can use the Pivot, Panorama templates, we can use the MVVM (Model-View-ViewModel) design pattern, and first we will learn how to add new pages to the project and move between them.
In the Solution Explorer window, right-click on the project name, and in the menu that appears, select Add, then New Item, in the dialog box that opens, select Windows Phone Portrait Page and name it SecondPage.xaml:
We now have a blank XAML page, an exact copy of the MainPage.xaml page before we edited it.
To better distinguish between pages, let's go to the XAML code of the SecondPage page and edit the TextBlock element with Name PageTitle Text property as below:
Navigation between application pages
So, we have two pages in the project; when the application starts, the MainPage.xaml page is displayed. How can I now move from MainPage.xaml to SecondPage.xaml?
Let's try two simple ways, how to do it.
In the XAML code of the MainPage.xaml file after the Button code we added earlier, add the HyperlinkButton code as shown below:
The HyperlinkButton control has a special property, NavigateUri, which allows you to specify the Uri to navigate to. Let's add this property with the value /SecondPage.xaml, as shown below:
Let's launch the application (F5).
When the application interface is displayed, if we click the Second Page link, we will be taken to the second, previously created SecondPage.xaml page. If we then press the hardware Back button, we will return to the main (previous) page - by default, this button allows you to go to the previous active page.
Now let's take advantage of the programmatic transition. First, add the following code to the using section:
Private void MyButton_Click(object sender, RoutedEventArgs e) ( NavigationService.Navigate(new Uri("/SecondPage.xaml", UriKind.Relative)); )
Launch the application (F5) and make sure that the button works as well as the link.
Let's add controls and code to the second page (SecondPage.xaml) that would allow you to return to the previous page.
In the XAML code of the SecondPage.xaml file, inside a Grid element named ContentPanel, insert Button and HyperlinkButton controls, as shown below:
To create a handler Click events MyButton button on the SecondPage page, right-click on the MyButton_Click text in the XAML editor and select Navigae to Event Handler.
Run the application (F5) and verify that the "First Page" link on the second page returns the application to MainPage.
Now let's take advantage of the programmatic transition. In the SecondPage.xaml.cs page code, add the following code to the using section:
Using System.Windows.Navigation;
And then, replace the MyButton_Click handler code with the following:
Private void MyButton_Click(object sender, RoutedEventArgs e) ( NavigationService.GoBack(); )
Run the application (F5) and make sure that the Back button on the second page returns the application to MainPage.
Please note that in the code that runs when the button is clicked, we did not use the name of the page to which we need to go, but asked the navigation service, represented by the NavigationService class, to go to the page that was in the navigation stack before the current one.
Page transition events can be processed programmatically, for example, to check with the user whether he really wants to leave the current page.
Add the following code to the SecondPage.xaml.cs file right after the MyButton_Click handler:
Protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) ( base.OnNavigatingFrom(e); // If the navigation can be canceled, check with the user whether he wants to remain on the current page if (e.IsCancelable) ( MessageBoxResult result = MessageBox.Show("Can will you stay?", "Confirmation of transition", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) ( // The user decided to stay e.Cancel = true; return; ) ) )
The code is simple enough that you can figure it out on your own.
Launch the application (F5) and notice that the clarifying dialog is displayed regardless of whether you are going to return to the MainPage by clicking a button or following a link.
Now all that remains is to learn how to pass parameters between pages.
Double-click on MainPage.xaml to move on to editing the main page. In the MainPage.xaml code, let's add a TextBox control above the Button element, as shown below:
Double click on SecondPage.xaml to move on to editing the main page. In the SecondPage.xaml code, let's add a TextBox control above the Button element, just like on the MainPage page:
Now, in the MyButton_Click event handler of the MainPage page, add parameters to the Uri of the transition to the second page using the button:
Private void MyButton_Click(object sender, RoutedEventArgs e) ( NavigationService.Navigate(new Uri("/SecondPage.xaml?text="+Uri.EscapeDataString(MyTextBox.Text), UriKind.Relative)); )
And finally, in the code of the SecondPage.xaml.cs page, immediately after the OnNavigatedFrom handler, we will add an arrival handler to the OnNavigatedTo page and in it we will process the incoming parameter and display it in MyTextBox:
Protected override void OnNavigatedTo(NavigationEventArgs e) ( base.OnNavigatedTo(e); if (NavigationContext.QueryString.ContainsKey("text")) ( MyTextBox.Text = NavigationContext.QueryString["text"].ToString(); ) )
Launch the application (F5) and check how it works, for example, when following a link from the MainPage to SecondPage.
Results and next steps
So, we figured out what we need to install to develop for Windows Phone 7, got acquainted with the available templates and learned how to create a new application from a template. We also learned how to add controls directly to XAML code, add new pages to the project and organize navigation between them by link and in code with the ability to pass parameters.
In the next step, we'll look at some of the markup options available in Silverlight, look at basic controls, and learn what an input context is for text fields.
There is an opinion that in real life, smartphones with Microsoft OS are found as often as people with the patronymic “Artemovich”. The strange (to put it mildly) policy of the “Evil Corporation” regarding the seventh and eighth families of the mobile operating system has 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 marching around the planet, its main trump card is one core for all platforms, and therefore it has every chance of winning over a good part of the 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 application runtime system, once written, the application will run on all devices under Windows control 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 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 this driver, the same.
UWP supports both kernel-level and user-level drivers. The subsystem includes device driver interfaces (DDI), of which the driver for UWP 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 for Visual Studio 2015, a user interface modeling tool, provides enhanced UI design capabilities over 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, among them creating animation 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, Xamarin is built into Visual Studio 2015, 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 versatile applications with 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 operating room Windows systems A colossal number of different applications have been created for it. With the release of Windows 8 and WinRT (and later Windows 10 and UWP), old classic 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, you can run it on mobile device V Windows environment 10 Mobile. One program can contain code in C++ and Obj-C.
If you have a project for the past Windows versions 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.).
The continuation of the article is available only to subscribers
Option 1. Subscribe to Hacker to read all articles on the site
Subscription will allow you to read ALL paid materials on the site, including this article, for the specified period. We accept payment bank cards, electronic money and transfers from mobile operator accounts.
Publication date: 15.09.2015
For those who doubt whether or not to bet on their favorite Windows machine 10, we suggest short review 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 making a backup of 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.
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. This is similar to the Windows 8/8.1 Developer License when you create 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.