"Windows10iot Development Series" "hello,world! "Guidance

Source: Internet
Author: User

Original: "Windows10 IoT Development Series" "hello,world! "Guidance

This article is mainly about using C # to develop a basic project that can run on raspberry Pi2.

1. After you start Visual Studio2015, select file → New project.

In the New Project dialog box that opens, select General.

Select the first item " Blank app (Universal Windows)"

New Project

Note: If this is the first project that you created, VisualStudio may prompt you to enable Windows 10 developer mode.

2. Add an app to the Windows IoT Extension SDK

The extension SDK for IoT is not added to the project by default, so we need to add it manually to ensure that the related naming such as Windows.Devices.Gpio can be used in the project.

Operation mode:

Right-click the project, select "References" → "Add Reference", select "Universal windows" → "Extensions" → "Windowsiot Extensions for UWP" in the dialog box.

to add an extension SDK to a project


3. Add content to MainPage.xaml

In Solution Explorer, select MainPage.xaml, which is primarily used to display some of the interaction information for the interactive interface. Let's say we need to add a text box and a button now, so we need to modify the XAML file.

Locate the XAML section located in the designer > and add the following:

"{Themeresourceapplicationpagebackgroundthemebrush}" >

horizontalalignment= " center Span style= "Color:rgb (213, 106, 0); font-size:17px; Word-spacing:normal; " >"verticalalignment= " center Span style= "Color:rgb (213, 106, 0); font-size:17px; Word-spacing:normal; " > " >

x:name="HelloMessage"text="hello,world!"margin="Ten"isreadonly="True"/>

x:name="ClickMe"content="clickme!"margin="Ten"horizontalalignment="Center"/>

After you add a text box and a button, you start adding code that executes when the button is pressed. Then double click on the Create successful button in the preview on the left, add the property click to the button XAML by VisualStudio, and generate the Clickme_click . Let's add a simple line of code for this:

MainPage. Xmal:

\"ClickMe"Content="点击我!"Margin="10" HorizontalAlignment="Center"Click="ClickMe\_Click"/\>

MainPage.xaml.cs:

privatevoidClickMe\_Click\(objectsender,RoutedEventArgs e\)​{this.HelloMessage.Text="Hello, Windows IoTCore!"; }

​4.在本地调试应用(请先确定已经通过"生成"|"生成解决方案"命令生成相关应用)

由于其属于Windows 通用应用(Universal WindowsPlatform),故你可以在装有Visual Studio 2015的设备上测试它。

Debug Applications

5. Deploy your app to devices running Windowsiot

① Select remote computer Debugging in the menu bar, enter the IP address or name of the device in the Remote Connection dialog box that appears, and select None at Windows authentication .

Remote Debugging

② Press F5 (or select Debug | Start debugging) to start debugging your app, see the app appear on the Windows IoT core device screen, and click the button.

③ during deployment, "Unable to connect to the Microsoft VisualStudio remote Debugger named ' XXXX ' if prompted". Visual Studio 2015 Remote Debugging program (MSVSMON. EXE) does not appear to be running on the remote computer. ", the remote debugger may have timed out. Use PowerShell to connect to your device and query the active process by running tlist .

if no msvsmon.exe exists in the list, run the command to restart the remote debugger (you can also restart your device): schtasks/run/tn Startmsvsmon .

④ set breakpoints, view variable values, and so on during debugging. To stop the app, press the Stop Debugging button (or select Debug | Stop Debugging ").

⑤ After you successfully deploy and debug this UWP app, change the Visual Studio toolbar Configuration drop-down list from Debug to release to create a pre-release version. You can select the Build | Regenerate Solution and Build | Deploy the solution, build the app and deploy it to the device.

a Hello world! running on an IoT device That's it, if you have a WINDOWS10 for iotcore device that you can run and you've installed Visual Studio 2015, why don't you try it.

Disclaimer: The main information in this article is from the Windows Development Center.

"Windows10 IoT Development Series" "hello,world! "Guidance

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.