Development Preparation for Windows App development, windowsapp

Source: Internet
Author: User
Tags old windows

Development Preparation for Windows App development, windowsapp
Operating System and SDK Operating System

Obviously, to develop a Windows App, you have to go to Windows 8/8. 1/10. The old Windows XP, Vista, and 7 cannot meet the needs of the times. Of course, during the development of Windows apps, Windows 10 is also greatly changed. to use new features, we recommend that you use Windows 10. When I wrote this tutorial, the official version of Windows 10 was not available, so the new features of Windows 10 were not introduced for the moment, and will be updated later. Thank you for your continued attention.

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.

Visual Studio

Visual Studio series, as the most powerful IDE on the earth, is naturally indispensable for learning Windows App development.

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 encounter any problems, you can email me when you find or find the solution. I will update it here. My mailbox is nomasp@outlook.com.

Windows App introduction C #

C # Is the programming language promoted by Microsoft and the most suitable development language for Windows apps. Therefore, C # is used in this tutorial.

Develop a Windows App. You can use Windows XAML (C #, C ++, and VB), WinJS (HTML + JavaScript), DirectX (C ++), and other combinations. Silverlight (C # and VB) are unique to WP, and Silverlight has been basically eliminated. We recommend that you use C # + XAML for development. In terms of Game Development and image processing, C ++ is more advantageous.

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.

Although everyone is working on cross-platform applications, I am optimistic about the concept of general applications. There have been rumors that Windows 10 is compatible with Android applications. At the Microsoft 2015 Build conference, Microsoft announced that android applications can be easily and quickly transplanted to the Windows platform, in this way, the huge differences in application design style will gradually disappear. In addition, we will wait and see if the Free Upgrade Plan for Windows 10 can drive the development of the mobile edition through the desktop edition.

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 installation, you can start work.

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

After the solution manager is created, the following interface is displayed:

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.

Tips for using Visual Studio row number

I can see that the VS of many shoes does not enable the row number, but how many lines of code I have written will undoubtedly make me 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.

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.

When you scroll the scroll wheel before and after the scroll wheel, the window in the designer will move up and down. If you hold down Shift, it will move left and right.

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.

If you have more suggestions, please email me.

Copyright Disclaimer: This article is an original article by NoMasp ke yuwang. If you need to reprint it, please contact me. Share the light of wisdom and protect intellectual property rights.

Related Article

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.