Creating a New Project


After successful installation, you can launch Visual Studio 2005 and create a new project (File | New | Project). This will bring up the dialog box you see in Figure 3-1. If all went well with setup, you will now have a new project type available to you under the Visual C# root: Micro Framework.

image from book
Figure 3-1: New project type option in the New Project dialog box.

With this project type selected, you can now select among four templates that were installed during setup: .NET Micro Framework Console Application, .NET Micro Framework Window Application, .NET Micro Framework Class Library, and .NET Micro Device Emulator. We will be creating a console application, which can be thought of as containing your program entry point and core classes; class libraries are useful for grouping code logically or for reuse among several projects, such as a utility library that encapsulates your common helper classes. Each of these, in turn, is considered to be a .NET assembly, which contains your code, resources (for example, bitmaps, fonts, sounds, and localized strings), and metadata (information about your application) needed by the runtime.

After naming your project (for example, HelloMicroFramework) and verifying the location on your hard drive, click OK, and Visual Studio will use the .NET Micro Framework Application template to create a new empty project that has been configured for executing in the Emulator or on an actual device. To verify this, let's look at what we created.

Exploring the .NET Micro Framework Libraries

First, open the Solution Explorer and expand the References node under your new project. As shown in Figure 3-2, there is a reference to a new .NET Micro Framework assembly: Microsoft.SPOT.Native. ("Native" refers to the fact that, internally, most of the implementation is in native, not managed, code within the runtime.)

image from book
Figure 3-2: New assembly reference after project creation.

Inside Out 

The root namespace for the .NET Micro Framework is Microsoft.SPOT because of its roots as the platform for the SPOT devices. Due to the many shipping products and for continued compatibility reasons, the decision was made to retain the name.

This assembly contains the essential classes and definitions within several namespaces (Microsoft.SPOT, Microsoft.SPOT.Hardware, and Microsoft.SPOT.Messaging) that you will use in your project to interact with the platform, such as timers, mathematical functions, network messaging, generalized input and output, and event or data logging. (We'll be covering all of this in detail shortly; see, for instance, Chapter 4, "Building a Device," for use of the .NET Micro Framework abstractions surrounding resistors, interrupts, thread synchronization, timers, and so on.) Feel free to open the Object Browser (as shown in Figure 3-3) and explore the namespaces as well as the classes and definitions they contain.

image from book
Figure 3-3: Exploring the Microsoft.SPOT.* namespaces in the Object Browser.




Embedded Programming with the Microsoft .Net Micro Framework
Embedded Programming with the Microsoft .NET Micro Framework
ISBN: 0735623651
EAN: 2147483647
Year: 2007
Pages: 118

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net