In this section, we will create a very simple “Hello World” program. Although this program is very simple, it will illustrate the process that we must go through to develop, deploy and debug any CUWIN program. The following video also illustrates this procedure, though with a slightly different program.
1. Start Visual Studio 2008 by selecting it from the Start Menu.
2. If this is your first time to run Visual Studio, it will ask you to choose your primary development environment. For the exercises in this document, it is recommended that you choose “Visual C# Development Settings”. Then click the “Start Visual Studio” button.
3. Visual Studio will open to the “Start Page”. Now we need to create a project.
4. Select “File”→”New…”→”Project…” from the menu.
5. Select “Visual C#”→“Smart Device” from the “Project Types” tree, and “Smart Device Project” from the “Templates” list. Makes sure “.Net Framework 3.5” is selected from the top, righthand corner, and change the “Name” of the project to “HelloWorld”. Then click the “OK” button.
6. Another dialog will display asking for more project configuration. Select “Windows CE” from the “Target Platform” list, and “.Net Compact Framework 3.5” from the “.Net Compact Framework Version” list. Then, select “Device Application” from the “Templates” list, and click the “OK” button.
7. Finally, the project will open, and we are ready to start programming.
8. Move your mouse over the “Toolbox” tab on the left side of the screen, and the “Toolbox” menu will open. Select or drag a “Button” to the form. A new button labeled “button1” will appear on the form.
9. Position the button to the bottom of the form, and resize the button so it is easy to touch on the touch screen.
10. If the “Properties” window is not yet displayed, select “View”→”Properties Window” from the menu, and it should appear in the bottom, right-hand corner of the screen.
11. In the “Properties” Window change the “Text” property to “Say Hello” and press the “Enter” key. You'll see the button's label change to “Say Hello”
12. Now, double-click on the button and you will be taken to the button's event handler. It is here you you tell the program what to do when the button is clicked. Add the line MessageBox.Show(“Say Hello!”);
13. We are finished editing the code necessary to build this program. Now, we need to make some project configuration changes in order to build the program for the CUWIN. Right-click the “Hello World” project node in the “Solution Explorer” window, and choose “Properties”.
14.Choose the “Devices” tab on the left-hand side of the screen. Under “Deployment Options” change the “Target Device” to “CUWIN2450 ARMV4I Device”. The CUWIN comes with the .Net Compact Framework 3.5 pre-installed, so if you don't have any updates, uncheck the “Deploy the latest version of the .Net Compact Framework (including Service Packs)” checkbox.
15. To execute the program, ensure the CUWIN in powered on and is connected to the PC, and click the “Start Debugging” button on the toolbar.
16. If a “Deploy HelloWorld” dialog is displayed, choose “CUWIN2450 ARMV4I Device” from the “Device” options, and click the “Deploy” button. The program will compile, upload to the CUWIN, and begin executing.
17. The program's main window will then appear on the CUWIN. Touch the “Say Hello” button and a message box will appear saying “Hello!”.