[Wanli journey-Windows App development] development preparation and journey app

Source: Internet
Author: User
Tags old windows

[Wanli journey-Windows App development] development preparation and journey app
Operating System and SDK Operating System

If you plan to develop a Windows App, your computer will not be able to use the old Windows 7. Windows 8.1 is recommended. When I wrote this blog, I used Windows 10 Pro Technical Preview [Build 10041].

In addition to downloading the operating system from the official website, you can also download the operating system from DreamSpark and other places. In DreamSpark, Microsoft operating systems, development tools, and other software except Office are free for students.

We also recommend another website: MSDN I tell you

Visual Studio

Visual Studio series, as the most powerful development tool, is naturally indispensable for learning Windows App development. Visual Studio can also be downloaded from the above MSDN I tell you.

In addition, this blog series mainly targets Windows apps (formerly known as the Universal Windows App, or UWA), so the sdk I use is still a Preview version-Visual Studio 2015 Preview [CTP 6].

Installation Problems

When Visual Studio 2013/2015 is installed on a blue screen, uninstall the NIC Driver and reinstall it, especially in earlier versions of Visual Studio 2013 and on-campus telecom network.

If you have any questions, please leave a message.

Windows AppC #

C # Is the programming language promoted by Microsoft and the most suitable development language for Windows apps. Therefore, C # is used to explain this series of blog posts. The following describes the related frameworks.

To develop a Windows App, you can use Windows XAML (C #, C ++, and VB), WinJS (HTML + JavaScript), and DirectX (C ++ ). Silverlight (C # and VB) is unique to WP.

XAML

Extensible Application Markup Language (XAML for short, pronounced Zamel) is a part of WPF. Its syntax is similar to HTML, and they are all "Markup languages ". I learned HTML after XAML first, and I liked this language very much at first-it didn't have a lot of ";". In essence, XAML is A. NET programming Language and a Common Language Runtime (CLR ).

I have seen a lot of tutorials and explained xmlns and Other Namespaces at the very beginning. I think this is not suitable. After all, I can't remember it because it is useless at all, you will naturally be impressed when you need it.

General applications

In fact, I think the "general application" name is obviously more appropriate and focuses more on the "general application" features. It can run on all Windows platforms, not just PCs, tablets, mobile phones, but even Xbox. It can share most of the Code on multiple platforms so that it can be developed at a time and run on multiple platforms.

I am very optimistic about this strategy, but recently there have been various news that Windows 10 may be compatible with Android applications, and I really don't want Microsoft to do this, at the very least, Android, Win8, and even win10.

Create the first application and create a project

If the installation is not solid, the installation process will be very long. Please wait patiently. After the installation, You can rub your hands to start work.

Ctrl + Shift + N call out the new project window.

After the creation is complete, the following style will be displayed in solution Manager:

If the solution manager is not displayed, press Ctrl + W, S. Alternatively, you can click View in the top toolbar ). Right-click Solution 'windowsapp1' to continue creating the second project.

As shown in, there are three parts:
1) WindowsApp1.Windows (Windows 8.1)
2) WindowsApp1.WindowsPhone (Windows Phone 8.1)
Obviously, these two are Windows 8.1 and Windows Phone 8.1 in Windows applications. There are:
Properties: Application-related versions.
References: References are mainly used to reference third-party things, such as advertisements.
Assets: You can put the materials used by the App in this folder.
MainPage. xaml: The XAML code is written here. C # code needs to be written in the MainPage. xaml. cs file that appears after clicking the triangle on the left of MainPage. xaml.
Package. appxmanifest: A list of application packages, which will be detailed later.
The other one is the relevant certificate.
3) WindowsApp1.Shared
This is the essence of Windows apps (general applications). For example, you can put classes and resource files here.

Debug program

You can set whether to debug a Windows 8.1 application or a Windows Phone 8.1 application.

You can select local debugging or virtual machine debugging.

Hands-on operations

Write the following code in MainPage. xaml:

<Grid Background = "{ThemeResource ApplicationPageBackgroundThemeBrush}"> <TextBlock Name = "tblock" Text = "" FontSize = "50" Foreground = "Red" Margin = "173,78, 940,498 "/> <Button Name =" btn "Content =" display Name "Click =" btn_Click "Width =" 155 "FontSize =" 25 "Height =" 90 "Margin =" 170,286, 0,392 "/> </Grid>

Only two TextBlock and Button controls are used. The attributes are as follows:
Name: Control Name
Text: Text displayed by the TextBlock Control
FontSize: font
Width and Height: Width and Height
Margin: Margin. For more information, see the following blog.
Content: Content, which is displayed on the Button control.
Foreground: font color

There is also an event:
Click: Click Event

Double-click btn_Click and press F12 to quickly generate the corresponding function in the C # file.

Then Debug on the local computer or virtual machine.

Visual Studio tips

Seeing how many lines of code you have written will undoubtedly make you feel more fulfilled.
Click Tools on the toolbar, and then click Options to open the Text Editor and select All languages) ", just check the row number.

Shortcut Key

Automatic Alignment: Ctrl + K, Ctrl + F
Code: Ctrl + E, Ctrl + C
(Or: Ctrl + K, Ctrl + C)
Clear code comments: Ctrl + E, Ctrl + U
(Or: Ctrl + K, Ctrl + U)

View

1) when learning to develop, the "Object Browser" in the view is very useful.
2) the control in the toolbox can be directly pulled into the designer of MainPage. xaml. This is also the legendary "What you see is what you get ".
3) attribute: click a space and click attribute view to set its attributes and events.

Okay, this blog is over now. Goodbye next time!

Designer

Place the mouse pointer in the designer, hold down the Ctrl key, and move the scroll wheel to zoom in or out the view.

The mouse pointer is also placed in the designer, and the Space (Space) Key is installed, the pointer will become a small hand, then the designer can be moved.

Well, this blog is over now. Thank you for your support. I have been studying Win8 and WP8 for several months on and off, but it is not enough. I plan to take this opportunity to study the system again, we also hope that more people will be involved in the Windows 10 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.