Adobe® Digital Editions software.This eBook requires the free
Before downloading this DRM-encrypted PDF, be sure to:
Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
The primary goal of .NET Compact Framework is to bring the familiar experience of developing .NET applications for the desktop to the device world. Of the approximately six million Microsoft desktop developers in the world, it is estimated that perhaps two hundred thousand will turn their attention to the device world using the enabling technology of the .NET Compact Framework.To facilitate the goal of showing readers how to develop applications for the .NET Compact Framework, the book contains in-depth treatment in the following topic areas: Windows Forms and Threading, Network Programming, ADO.NET Dataset, XML Serialization, SQL CE, Web Services, and performance management. Each concept is accompanied with a sample application that illustrates its implementation on the .NET Compact Framework. For the convenience of the reader, each sample application will be offered in both C# and Visual BASIC. Developers can use this source code as a springboard for creating their own device side database applications.
What's in This Book. Conventions Used in This Book. What You'll Need. Online Resources.
Smart Device Extensions and the .NET Compact Framework.
System Requirements. The Development Process Using Smart Device Extensions. Creating a New Application for Pocket PC Devices. Opening an Existing Smart Device Extensions Project.
Targeting Nonstandard Devices.
How Visual Studio Communicates with Devices. Installing the .NET Compact Framework Manually. Devices with Unusual Memory Maps. Connectivity Summary and Troubleshooter.
Why the .NET Compact Framework? Examining the .NET Compact Framework in Detail.
The Common Language Runtime. Comparing the .NET Compact Framework CLR to the Desktop CLR. The .NET Compact Framework Class Libraries.
Investigating Unsupported Controls in the .NET Compact Framework. Investigating Unsupported System.Windows.Forms Functionality in the .NET Compact Framework. Working with the Visual Studio .NET Form Designer.
The Form Designer Window. The ToolBox Window. The Properties Window. Adding Events Handlers.
Understanding the Different Windows Forms Target Platforms.
Understanding Windows CE .NET Projects. Understanding Pocket PC Projects.
Working with the Form Control.
Understanding the Effects of the FormBorderStyle Property. Using the ControlBox Property. Understanding the MinimizeBox and MaximizeBox Properties. Understanding the WindowsState Property. Understanding the Size Property. Setting the Location of the Form by Using the Location Property.
Programming the Button Control. Using the TextBox Control. Using the Label Control. Working with RadioButton Controls. Using the CheckBox Control. Using the ComboBox Control. Using the ListBox Control. Using the NumericUpDown Control. Using the DomainUpDown Control. Programming the ProgressBar Control. Using the StatusBar Control. Using the TrackBar Control. Using the ToolBar Control.
Adding a ToolBar Control to an Application. Handling a ToolBar's ButtonClick Event.
Adding Menus with the MainMenu Control. Using a ContextMenu Control in an Application. Using the Timer Control. Using the OpenFileDialog and SaveFileDialog Controls. Using the Panel Control.
Using the HScrollBar and VScrollBar Controls. Using the ImageList Control. Using the PictureBox Control. Using the ListView Control.
Adding Columns to the ListView. Adding Items to the ListView Control. Determining the Selected Item. Additional ListView Control Properties.
Using the TabControl Control. Using the TreeView Control.
Understanding TreeView Properties. Adding TreeNodes to a TreeView Control. Determining the Selected TreeNode.
Working with the DataGrid Control.
Populating the DataGrid Control. Customizing the DataGrid Control. Determining the Selected Row or Selected Cell in the DataGrid.
Threads, Timers, and Windows CE. The Thread Class. Understanding Thread Basics.
Creating and Starting a Thread. Writing Code to Start a Thread. Suspending a Thread. Using Threads with User Interface Controls. Quitting Threaded Applications. Coding a Multithreaded Application: SimpleThread.
Coordinating Threads with the Mutex Class.
Suspending and Resuming Threads with Mutexes. Examining a Sample Application: SuspendAndTerminateThreads.
Blocking until a Thread Finishes.
Waiting for a Thread: The JoinDemo Application.
Controlling Access to Data Objects with the Monitor Class.
Simulating the Producer-Consumer Problem.
Managing Multiple Threads with a Thread Pool.
Controlling Threads with the ThreadPoolDemo Application.
Creating a Timer. Setting the Tick Interval. Suspending and Resuming Timers. Manipulating Timers with a Sample Application.
Updating Variables with the Interlocked Class.
Incrementing a Variable. Decrementing a Variable. Exchanging a Value into a Variable.
Working with Sockets.
Choosing a Protocol: TCP/IP versus UDP. Understanding IP Implementations: IPv4 versus IPv6.
Socket Programming with the .NET Compact Framework.
Making a Connection as a Client. Receiving a Connection as a Host. Reading and Writing with a Connected Socket. Sample Application: Remote Hello.
Serializing Objects for Transmission through a Socket.
Serializing Packets: Sample Application.
Using UDP Packets.
Writing Code for UdpClient. Writing for the UdpClient: Sample Application.
Multicasting with UDP Packets.
Sending Multicast Packets. Receiving Multicast Packets.
Communicating with Remote Servers through the HTTP Protocol.
Nuts-and-Bolts Usage of HttpWebRequest. Coding Sample for HttpWebRequest. Writing Applications with the HttpWebRequest: WebHello Sample.
Communicating with Remote Servers through the HTTPS Protocol. Communicating through the Device IrDA Port.
Using the IrDAClient to Access the Device IrDA Port. Connecting to an IrDA Port as a Client. Establishing an IrDA Connection as a Server. Reading Data from an IrDAClient. Writing Data to an IrDAClient. Sample Application: IrDAChat.
Introducing ADO.NET on the .NET Compact Framework. Caching Data with the DataSet.
Looking Inside the DataSet: DataTables, DataRows, and DataColumns. Inserting Data into a DataSet. Building a DataSet to Hold a Phone Book. Extracting Data from a DataSet. Altering Data in a DataSet. Designing a PhoneBook Application with a DataSet. Troubleshooting Common DataSet-Related Errors.
Adding Constraints to a DataSet. Adding a UniqueConstraint. Working with a UniqueConstraint by Example. Preventing NULL Values in a DataColumn.
Setting Up Autoincremented Fields.
Creating Autoincremented Field Code by Example. Updating the PhoneBook Application with Constraints and Autoincremented Fields.
Modeling Relational Data with the DataSet.
Deriving DataColumn Values with Expressions and Computed Fields. Expressing Parent-Child Relationships in a DataSet.
Creating Bindable Views of Data with a DataView.
Sorting with the DataView. Sorting and Filtering Data in a Sample Application. Tracking Changes in a DataRow. Filtering with the DataView. Adding Data into a DataView. Using a DataView in a Sample Application: DataView_SortByRowState_AddTables.
Binding Data to a Control.
Binding to a DataGrid. Using Data Binding in a Sample Application.
Comparing the Compact DataSet with the Desktop DataSet. In Brief.
Investigating the Features Supported by Microsoft SQL Server 2000. Creating a Microsoft SQL Server CE Database. Adding Structure to a Microsoft SQL Server CE Database. Populating a Microsoft SQL Server CE Database. Retrieving Data by Using SqlCeDataReader.
Using Parameterized SQL Commands.
Filling a DataSet by Using the SqlCeDataAdapter.
Handling the FillError Event.
Updating the Microsoft SQL Server CE Database by Using the SqlCeDataAdapter.
Handling SqlCeDataAdapter Update Events.
Generating SqlCommand Objects with the SqlCeCommandBuilder. In Brief.
XML and the .NET Compact Framework DataSet. Loading XML into a DataSet.
Loading from a File. Loading Data from a Stream. Inferring Schema.
Saving a DataSet as XML.
Saving to a File. Saving Data to a Stream. Writing Schema with the XML Data.
Loading and Saving XML in a Sample Application. Modeling Relational Data with XML Schemas.
Examining XML with the XML_DataSetView Utility. Examining a Simple Schema that Describes a Single Table. Autoincremented Fields and Unique Constraints. Describing Multiple Tables, ForeignKeyConstraints, DataRelations, and Computed Fields with XML Schema. Creating XML Data with the XML_Creator Utility.
Loading and Saving Schema Alone. Writing a DataSet to XML without Schema Information. Reading a DataSet from XML, Ignoring Schema Information. Inferring Schema. Using XML to Design a DataSet.
Schema Editing with the IDE.
Saving and Loading DataSets as XML DiffGrams.
How to Read a DiffGram. When to Use DiffGrams.
Creating a Simple XML Web Service. Understanding the .NET Framework Web Service Client. Creating a Client for the Simple XML Web Service.
Adding a Web Reference to a Client Application. Viewing the Proxy Class. Consuming the QuotableQuotes Web Service. Asynchronous Consumption of the Simple Web Service.
Consuming a Web Service That Uses a DataSet. Consuming Web Service That Exposes a Typed DataSet. In Brief.
XML Architecture Overview. Working with the XmlTextReader. Loading XML Data into an XmlTextReader.
Loading an XML Stream from the Local File System. Loading an XML File from a Remote Location.
Using the XmlTextReader's Namespaces Property. Understanding the Normalization Property. Controlling White-Space Interpretation with the WhitespaceHandling Property. Using the XmlResolver Property. Reading XML Nodes.
Reading XML Nodes with the Read Method. Reading the Start Element Tag. Reading Element Content as a String. Jumping to an Element's Content.
Reading XML Attributes.
Reading Attributes without Moving the Reader. Reading Attributes by Using Horizontal Movement.
Understanding How to Perform Full-Content Reads.
Reading All Content as String Data. Reading String Data in Chunks. Reading Binary-Encoded Data. Reading Element Content as Markup.
Skipping over Nodes. Closing the XmlTextReader. Working with the XmlTextWriter.
What Is Not Supported?
Creating the XmlTextWriter. Manipulating Namespace Support. Formatting the XmlTextWriter's Output. Writing an XML Declaration. Writing XML Elements. Writing XML Attributes. Writing xml:space and xml:lang Attributes. Writing Element and Attribute Content. Converting .NET Compact Framework Data Types through XmlConvert. Writing Raw XML Markup. Writing Other Nodes.
Writing Comments. Writing CDATA Sections.
Writing Processing Instructions. Writing White-Space Characters. In Brief.
Processing XML by Using the Document Object Model. Differences from the Desktop .NET Framework. Loading the XML DOM. Navigating the XML DOM.
Navigating Using HasChildNodes and ChildNodes. Navigating by Using Item Indexer Properties. Navigating by Using FirstChild and NextSibling. Navigating by Using ParentNode and OwnerDocument.
Accessing Text from Elements. Accessing Markup from Nodes. Accessing an Element's Attributes. Accessing Other XmlNodes. Searching an XML Document Node Tree. Creating XmlNodes. Creating XmlDeclarations. Creating XmlElements. Creating XmlAttributes. Creating Other Node Types. Inserting XmlNodes. Using the AppendChild and PrependChild Methods. Working with the InsertBefore and InsertAfter Methods. Inserting XmlAttributes into an XmlDocument. Replacing the XmlNodes within an XmlDocument. Removing XmlNodes for an XmlDocument. Removing XmlAttributes from their XmlElements. Writing the XmlDocument. In Brief.
Understanding When to Call Native Code. Calling Native Code: Quick Start.
Calling Native Code with Minimal Steps.
Marshalling the Fundamental Data Types.
Passing 32-bit Signed Integers. Passing 32-bit Unsigned Integers. Passing Single Precision Floating-Point Types. Passing Signed Long Integer Types. Passing Unsigned Long Data Types. Passing Short Integers. Passing Unsigned Short Integers. Passing Single Characters. Passing Bytes. Passing Boolean Values. Passing a DWORD. Passing an IntPtr. Passing Non-Mutable Strings. Passing Mutable Strings with System.Text.StringBuilder. Converting Data to Strings with the FundamentalToString Sample Application.
Marshalling Simple Structures.
Marshalling Shallow Structures with the MarshalShallowStruct Sample Application.
Passing Nested Structures by Using Custom Marshalling Code.
Marshalling Deep Structures with the MarshalDeepStruct Sample Application.
Calling the Windows CE Operating System.
Calling the Windows CE API to Play a Sound. Putting It All Together with a Sample Application: PlaySound.
Accessing COM Components from the .NET Compact Framework. In Brief.
Understanding the .NET Compact Framework Reflection API. Loading .NET Assemblies. Discovering Type Information.
Retrieving Type Information with the GetType Method. Retrieving Type Information from a Loaded Assembly.
Creating Type Instances by Using ConstructorInfo.
Using the GetConstructors Method. Retrieving Individual ConstructorInfo Objects with GetConstructor. Creating Object Instances with the ConstructorInfo Class.
Invoking Methods by Using the MethodInfo Class.
Working with the GetMethod Method. Invoking a Method with the MethodInfo Class.
Using Reflection to Manipulate Object State.
Discovering a Type's Field Information by Using the GetFields method. Discovering a Type's Field Information by Using GetField Method. Using the FieldInfo Class to Retrieve a Field's Value. Using the FieldInfo Class to Change a Field's Value. Discovering a Type's Property Information by Using the GetProperties Method. Discovering a Type's Field Information by Using the GetProperty Method. Using the PropertyInfo Class to Retrieve and Change the Value of the Property.
Adding Custom Metadata to .NET Elements.
Defining a Custom Attribute. Retrieving Custom Attributes.
Cryptography on the .NET Compact Framework.
Performing Cryptography with the ManagedCryptoAPI Class.
Invoking the CryptoAPI.
Using Handles to Interact with CryptoAPI. Understanding the CryptoAPI Context.
Computing a Hash.
Looking Inside ManagedComputeHash. Computing a Hash with a Sample Application.
Encrypting and Decrypting Data by Using a Password.
Looking Inside PasswordEncrypt. Looking Inside PasswordDecrypt.
Using Session Keys to Encrypt and Decrypt Data.
Storing a Session Key for Use Only by the Device That Created It. Importing a Previously Saved Session into the Same Device That Created It. Sharing a Session Key with a Remote Device. Encrypting and Decrypting by Using a Handle to a Session Key.
Determining CryptoAPI Constants with the ConstFinder Sample Application. In Brief.
Using a Stopwatch Timer to Measure Code Execution Time. Using .NET Compact Framework Performance Counters.
Turn On the .NET Compact Framework Performance Counters. Viewing the Performance Counters. Understanding the Performance Counters. Understanding the .NET Compact Framework's Garbage Collector. The NetCF Performance Counter Explorer.
Packaging a .NET Compact Framework Application. Using Visual Studio .NET to Package an Application. Using CAB Wizard to Package an Application.
Specifying the Application Version in the Version Section. Understanding the CEStrings Section. Specifying Custom Substitution Strings in the Strings Section. Understanding the DefaultInstall Section. Specifying the Desktop Location of the Application in SourceDisksNames Section. The SourceDisksFiles Section. Specifying the Final Application Destination Directory in the DestinationDirs Section. Running the CAB Wizard.
Distributing a .NET Compact Framework Application.
Distributing Your Application from a Web Site. Distributing Your Application from a File Share. Distributing Your Application on a Memory Card. Distributing Your Application Through ActiveSync.
Introducing the SmartPhone. Developing for the SmartPhone by Using the .NET Compact Framework.
Miscellaneous SmartPhone OS Issues.
Writing an Application for SmartPhone-XMLDataSetViewer.
Building the DataSetViewer from Scratch-Tutorial Steps. Using the XMLDataSetViewer.