Introduction

Welcome to the .NET Compact Framework, the fast, trimmed-down version of the Microsoft .NET Framework tailored especially for devices. The .NET Compact Framework is Microsoft's next-generation development framework for easily creating complex applications for the Pocket PC and Windows CE platforms. Using the .NET Compact Framework, developers can target Windows CE using C# or Visual Basic. For the first time, developers need not become experts in writing for Windows CE in C/C++, nor need they settle for the previous, watered-down Visual Basic dialect, Embedded Visual Basic.

This book will bring you up to speed on how to use Smart Device Extensions in Visual Studio 7.1 to write, deploy, and test applications that target the .NET Compact Framework.

If you have a Windows CE device and you wonder how to get the .NET Compact Framework running on it, this book can help. It details how to get around the most common obstacles developers face when trying to target Windows CE devices.

This book is aimed at developers already familiar with either C# or Visual Basic .NET. It does not spend any time introducing elements of language syntax or programming constructs. If you are an experienced .NET Framework developer, this book can help you understand what functionality is available to you on the .NET Compact Framework.

All of the topics covered in this book are treated with enough detail that a developer who knows nothing about the topic can master it by the end of the chapter. Each chapter is filled with code snippets and full sample applications to drive home the chapter's major points. All code snippets and sample applications are presented in both in C# and Visual Basic. Some sample listings include input data or special steps needed to use the code. Such information is always included after the C# and Visual Basic code listings.

What's in This Book

This book covers a full spectrum of topics, teaching readers how to solve a wide variety of problems by using the .NET Compact Framework, such as these:

  • Setting up the development environment

  • Targeting nonstandard Windows CE devices

  • Understanding the connectivity layer between Visual Studio and your device

  • Deploying the .NET Compact Framework manually

  • Understanding the Common Language Runtime for the .NET Compact Framework

  • Optimizing your code for the Just-In-Time compilers used by the .NET Compact Framework

  • Avoiding code pitching

  • Designing .NET Compact Framework applications by using the Visual Studio.NET Form Designer

  • Designing applications for different target platforms

  • Working with the .NET Compact Framework UI controls

  • Multithreading on the .NET Compact Framework

  • Using Timers on the .NET Compact Framework

  • Waiting for a thread to finish

  • Invoking user interface elements from outside threads

  • Coordinating threads with a Mutex

  • Managing threads with a thread pool

  • Atomic variable updates

  • Controlling access to data objects with a Monitor

  • Connecting with sockets to a remote party by using TCP/IP

  • Accepting socket connections from a remote party by using TCP/IP

  • Reading and writing data by using a connected socket

  • Communicating with the UDP protocol and multicasting

  • Serializing objects

  • Interacting with HTTP and HTTPS servers

  • Communicating with another device by using the infrared port

  • Creating and populating a DataSet

  • Extracting and altering data in a DataSet

  • Adding constraints to a DataSet

  • Setting up parent-child relationships in a DataSet

  • Defining columns with an expression

  • Setting up an autoincremented column

  • Creating sorted views of data with a DataView

  • Binding a DataView to a DataGrid

  • Creating a Microsoft SQL Server CE database

  • Interacting with a Microsoft SQL Server CE database by using the SQL CE managed providers

  • Using the DataSet to manage a Microsoft SQL Server CE database

  • Loading and saving a DataSet as XML by using files and streams

  • Using XML schema to describe a DataSet

  • Using the Visual Studio XML editor to alter the contents of a DataSet

  • Specifying how the DataSet treats schema information

  • DiffGram support on the .NET Compact Framework

  • Investigating the XML Web service architecture

  • Creating a Web service client

  • Consuming a Web service that exposes a DataSet

  • Reading XML documents with the XmlTextReader

  • Writing XML documents with the XmlTextWriter

  • Parsing XML documents with the XmlDocument

  • Using reflection to dynamically load .NET assemblies

  • Dynamically discovering type information by using reflection

  • Instantiating objects by using reflection

  • Invoking object members by using reflection

  • Encrypting and decrypting data by using a password or a session key

  • Creating, storing, loading, and sharing session keys

  • Computing a hash

  • Measuring the performance of a .NET Compact Framework application

  • Using the .NET Compact Framework performance counters

  • Packaging a .NET Compact Framework application

  • Building an application CAB file by using the CAB Wizard

  • Distributing a .NET Compact Framework application

  • Targeting the SmartPhone with the .NET Compact Framework

The sample applications for this book are available for download from the Sams Web site at www.samspublishing.com. All of the sample applications for this book are written in both C# and Visual Basic.

Conventions Used in This Book

The following typographic conventions are used in this book:

  • Code lines, commands, statements, variables, and code-related terms appear in a monospace typeface.

  • You'll see sidebars throughout the book, which are meant to give you something more, such as a little more insight or some new technique. Here's what a sidebar looks like:

To download the code on the Sams Web site at www.samspublishing.com, enter this book's ISBN (without the hyphens) in the Search box and click Search. When the book's title is displayed, click the title to go to a page where you can download the code.


What You'll Need

To use this book, you will need Visual Studio .NET Enterprise Developer or Enterprise Architect editions, version 7.1. The Professional edition does not include the Smart Device Extensions through which you can develop applications that target the .NET Compact Framework.

SHARING ENCRYPTED TEXT

Although password-based encryption and decryption is convenient, the resulting encrypted text is not necessarily portable to other devices. If your application calls for encrypting and decrypting data that can be securely exchanged between two devices, see the section titled “Encrypting and Decrypting by Using a Handle to a Session Key.”


Smart Device Extensions and the .NET Compact Framework enable you to target Pocket PC and Windows CE devices. It is strongly recommended that you have a device like the one you plan to support with your projects so that you can test your work. If you do not have a compatible device with which to test, you can use one of the device emulators included with the Smart Device Extensions.

Chapter 1, “Setting Up Your Development Environment,” describes specifically what Pocket PC and Windows CE devices are supported by the Smart Device Extensions. Also, Chapter 1 holds information about what specifications your desktop computer needs to use the Smart Device Extensions.

Online Resources

There are several places on the Internet where you can get help with the .NET Compact Framework and participate in discussions about it. There is an official Usenet group at http://microsoft.public.dotnet.framework.compactframework. Also, you can find useful tweaks and tools for Smart Device Extensions at http://smartdevices.microsoftdev.com.

You are now ready to start learning about how to use the .NET Compact Framework to create compelling applications for Pocket PC and Windows CE devices. I hope you have fun and learn a lot about this exciting platform.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.76.138