Operating system and SDK operating system
It's obvious that you want to develop Windows app on Windows 8/8.1/10, old Windows Xp/vista/7 can't meet the needs of the times. Of course, in the development of Windows app, it also has a large change, in order to use the new features, we recommend the use of Windows 10. When I was writing this tutorial, the Windows 10 release was not available, so the new features on Windows 10 are not covered for the time being and will continue to update and you are welcome to continue.
Operating system In addition to the official website download, but also in DreamSpark and other places to download. Other Microsoft operating systems, development tools, and other software on DreamSpark are open to students free of charge.
Visual Studio
The Visual Studio family is the most powerful IDE on the planet, and learning Windows app development is natural.
In addition, because the main direction of this blog series is the Windows app (formerly known as universal Windows app, referred to as UWA), so I use the SDK is still preview version--visual Studio [CTP 6].
Installation troubleshooting
When installing Visual Studio 2013/2015, when the blue screen appears, uninstall the NIC driver and reinstall it, especially in the case of earlier versions of Visual Studio 2013 and with the campus telecommunications network.
If you have any problems, you can email me when you find or find a solution, I will update here. My e-mail is [email protected].
Introduction to Windows App C #
C # is a Microsoft-driven programming language and the most appropriate development language for Windows apps, so this tutorial is unified in C #.
Develop Windows apps that can be combined with Windows XAML (C #, C + + and VB), WinJS (Html+javascript), DirectX (c + +), and more. Silverlight (C # and VB) is unique to WP, Silverlight has been basically eliminated, it is recommended to use C#+XAML to develop, in game development and image processing, C + + is more advantageous.
Xaml
Extensible Application Markup Language (abbreviated as XAML, pronounced Zamel) is part of WPF, which is syntactically similar to HTML, and they are all "markup languages." I was the first to learn the HTML of the XAML, and at first I liked the language-it didn't have a lot of ";". XAML essentially belongs to a. NET programming language that belongs to the common language runtime (Common Language runtime, or CLR).
See a lot of tutorials and so on at the beginning to explain the xmlns such as the name space, I think this is not very suitable, after all, it is not used at all, so also can not remember, wait until the time when the natural will be impressed.
General application
In fact, I think the name "Universal application" is obviously more suitable, more emphasis on the "general" characteristics. It can run on all Windows platforms, not just PCs, tablets, phones, and even Xbox. The ability to share most of the code on multiple platforms, enabling it to be developed at once and run on multiple platforms.
Although the cross-platform everyone is doing, but the general application of the concept I still very optimistic. There have been rumors that Windows 10 is compatible with Android apps, and at the Microsoft Build Conference, Microsoft announced that it was migrating to the Windows platform with great ease and speed through the Android app, although that would be a feature of the huge differences in application design styles. And let's wait and see if the free upgrade plan for Windows 10 can drive the development of mobile through the desktop version.
Create your first app new project
If it is not installed solid state then the installation process will be very long, please wait patiently. You can start the work after you've installed it.
Ctrl+shift+n call out the new Project window directly.
After the new completion, the solution Manager will be the following interface:
If the solution Manager is not displayed, you can press ctrl+w,s. Or, you can click View in the top toolbar. Right-click on solution ' WindowsApp1 ' to continue with the creation of the second project.
A total of 3 sections are shown in:
1) windowsapp1.windows (Windows 8.1)
2) Windowsapp1.windowsphone (Windows Phone 8.1)
Obviously these two are the Windows 8.1 and Windows Phone 8.1 parts that are part of the window app. The following are also:
Properties: Apply some of the relevant version numbers, and so on.
References: References are mainly used to refer to third-party stuff, such as advertising.
Assets: You can put the assets used in the app and so on in this folder.
The MainPage.xaml:XAML code is written here, oh, C # code needs to be written in the MainPage.xaml.cs file that appears after clicking the triangle to the left of MainPage.xaml.
Package.appxmanifest: Some of the list of application packages, which are later used in detail.
The remaining one is the relevant certificate.
3) windowsapp1.shared
This is the essence of the Windows app (universal application), such as the class, resource files, etc. can be put here.
Debug program
Here you can set up a debug Windows 8.1 app or a Windows Phone 8.1 app.
Here you can choose to debug in native debugging or in a virtual machine.
Hands-on Operation
Write down the following code in MAINPAGE.XAML:
<Grid Background="{ThemeResource Applicationpagebackgroundthemebrush}"> <textblock name="Tblock" Text="" FontSize=" the"Foreground="Red"margin="173,78,940,498"/> <ButtonName="BTN"Content="Show name"click="Btn_click"Width="155" FontSize="very"height=" the"margin="170,286,0,392"/> </Grid>
Only two TextBlock and button two controls are used, the properties of which are:
Name: Control names
Text:textblock the text displayed by the control
FontSize: Font
Width and Height: width and height
Margin: Margin, specific usage in the following blog will be introduced
Content: Contents, which appears on the button control
Foreground: Font Color
There is also an event:
Click: Tap Events
Double-click Btn_click with the mouse and press F12 to quickly generate the appropriate function in the C # file.
You can then debug on the local computer or on the virtual machine.
Visual Studio uses small trick line numbers
I've seen a lot of children's shoes vs have no open line numbers, and can see how many lines of code they write, will undoubtedly make themselves more sense of accomplishment.
Click Tools on the toolbar, then click Options, click the Text editor, select all Language, and tick the uplink number, and then tap on the "option" button.
Shortcut keys
Auto Alignment: Ctrl+k,ctrl+f
Comment Code: CTRL+E,CTRL+C
(Or: Ctrl+k,ctrl+c)
Clear code Comment: 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 controls in the toolbox can be pulled directly into the MainPage.xaml designer. This is the legendary "WYSIWYG".
3) Properties, click on a space and click on the Properties view, you can set its properties and events.
Designer
Place the mouse pointer over the designer, hold down the CTRL key, and then swipe with the mouse wheel to zoom in or out of the view.
When the mouse wheel scrolls back and forth, the window in the designer moves up or down and moves left and right if you hold down shift.
Also put the mouse pointer in the designer, install space (that is, the space) key, the pointer will become a small hand, you can move the designer.
If you have more suggestions, please email me.
Copyright NOTICE: This article is nomasp Couvant original article, if need reprint please contact oneself. Share the light of wisdom and protect intellectual property.
Development readiness for Windows app development