Win 10 Development 0 Basic teaching: teach you to be the first App--hello world

Source: Internet
Author: User

The long-awaited Win10 has been released, and developers can now develop the Win10 app. If you are WIN10 development of small white, if you have not been exposed to app development, do not be afraid, today teach you how to do a Hello World app! (This tutorial is suitable for small white, developers please ignore!) )

1, first open the vs2015, click on the file in the new-project,

Select "GENERIC"--select "Blank App" and name the project Hello world and click OK.

This time we have created a blank application.

2. First, let's meet the project composition of a blank application.

, click MainPage.xaml. To open the programming interface. In the UWA application, the main interface is the Design view, and we can view the current design of the phone or PC at any time. Through the switch. We are looking at the right side, is the entire project's constituent file, MainPage.xaml is the program default main interface file, below also has a MainPage.xaml.cs. This is the background CSharp code page for the page.

The basic idea of our program design is to interface with the XAML language in the foreground interface. Use the C # language to implement related functions in the background.

3, below. Start our first win 10 app. Hello World's Making!

Hello World app Function: Click a button, will pop up a display box, the above shows "Hello world".

Begin:

To start with, we can drag a control to the designer screen directly on the left-hand toolbox. We use the mobile phone design interface to do the demonstration, the PC interface is the same truth. We drag a button to the screen of the phone designer:

The following interface appears as shown, let's take a look. When you drag a button to the interface, a piece of code is automatically generated in the XAML code. The button represents the buttons. Content means that the contents are displayed, and we can see that the button shows the contents of the content part of the XAML code.

We make the button's content "OK" and give it "OK". We want to implement the button click, and the next thing we do is to add a click event for the button. Mouse click button, on the right side will appear the Button's property box, we will see a lightning sign. This is the representative of "event". The interaction in our application is actually done by triggering the event.

Click event is called Click. We can see that the first property is click. We double-click the property box on the right.

A click event is automatically generated. Button_Click. An event is added at the same time in the middle of the XAML code snippet. This is going to jump to the back office code. Such as

The C Sharp Background code page for the main page. The actions we are going to perform will be executed here through C # code. box is the Click event handler that was generated just after the click. All we need to do is implement a popup box within this function and display the text "Hello World".

Now let's add a simple line of code:

Await new Messagedialog ("Hello World"). Showasync ();

How do you understand this sentence? We know that in C #, what is needed is new, so we need a new dialog box, which is messagedialog. So this is new Messagedialog (), where Messagedialog need to import namespaces. Use the mouse to click on the tip above it. Messagedialog () in parentheses is the content to be displayed in the app's cue box. We write "Hello world". In the future, Hello World will be displayed in the app.

So we add a successful code, because it is an asynchronous operation, so you need to add the keyword, this can be remembered. In this way, our code is finished.

We're going to run the next thing.

Let's run the phone simulator first. Click, select the simulator below, click the green arrow to start running:

After the program runs up, we click OK. This will bring up a dialog that says Hello World!

So our first Win10 app is ready! Cheer it up!

Then run it on your PC. Select the local computer. Click Run.

PC application is also running up, click OK, show Hello world!

At this point all the content is finished. You can then deploy your app to the WIN10 system's phone or computer! Select device and select Deploy.

So the first win App Hello world is done! I believe, so detailed. Even the super white, but also the second understand Ah! Come on! Let us work together for WIN10 development!

--it Chase Dream Garden

Win 10 Development 0 Basic teaching: teach you to be the first App--hello world

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.