您的位置:首页 > 移动开发

The intro of .NET Compact Framework

2005-01-19 09:07 519 查看

Content

u What is the .NET Framework?

u Mobile Application Development

u What is the .NET Compact Framework?

u Development Environment

u .NET Compact Framework 2.0

u Future Windows Mobile Platform

u Summary

Momentum Continues To Build…

Microsoft Strategy

.NET Framework Definition

u The .NET Framework is a new computing platform that simplifies application development in the highly distributed environment of the Internet

.NET Framework in context

.NET Framework Architecture

Mobile Application Development

Windows Mobile Device

Definition: Mobile Solution

u Mobile solutions are defined as any application that enables seamless computing to enterprise applications and data regardless of the type, quality and duration of network connectivity.

Design Goals

u Target mobile and embedded devices

u Portable subset of .NET Framework

v No new ‘compact’ namespaces

v Visual Basic .NET and C# compiler
support in v1

u Leverage Visual Studio .NET

v Run managed .EXEs and .DLLs directly

v Debug with Visual Studio .NET

u Peacefully co-exist with host OS

v Run on native threads, P/Invoke to call native code

What is the .NET Compact Framework?

.NET Compact Framework

u Lightweight version of .NET Framework

u Designed for resource-constrained devices

u Compatible with VS.NET, C#, VB.NET

u Runs applications securely on-device

v High performance JIT compiler

v Guarantees robustness and security

v Highly interactive, offline, and networked experiences

v Makes it easy to consume web services

u Tunable size and performance

.NET Device Programming
Two approaches – one model, one tool

.NET Device Programming
Smart Device Programmability

.NET CF Design Goals

u Compatibility

v Strict compatibility with .NET Framework

v Subset functionality

u Subset for devices

v Give the developer
a known target

v Enable skills and
code transfer

v Size/functionality

Desktop .NET Framework

.NET Compact Framework

Framework Size

u Framework size (RAM or ROM)

v ~1.5 MB

u Running RAM needs

v 1 MB+ (depends on app)

u Typical application sizes

v 5 - 100 KB

v Apps often smaller due to use of platform features in the framework

.NET Compact Framework platform architecture

.NET CLR Common Features

u Verifiable type safe execution

v No uninitialized variables, unsafe casts, bad array indexing, bad pointer math

u Garbage Collection

v No ref-counting, no leaks

u JIT compilation

u Error handling with exceptions

u Common type system

v Call, inherit, and source-level debug across different languages

Compact CLR Differences

u COM Interop

v Good support for calling native DLLs

v Support for calling a COM object through DLL wrappers

v No support for writing a COM / ActiveX object in C# or Visual Basic

u No Install-time JIT (nGen)

u No Reflection Emit

u No Remoting

v Client web services is fully supported

u No Generic Serialization

v Datasets can be serialized to XML

u Subsets of other areas of functionality

The Development Environment

Creating A Device Project In Visual Studio

u Smart Device project type in the New Project dialog

u Select device platform and project type with the New Project Application Wizard

u New project has a default set of references that are appropriate for your platform

u Environment adapts to the new platform by inspecting references

Writing Your Application

u Toolbox has the device controls with the proper properties and events

v Device look and feel at design time

u IntelliSense™ targets the .NET Compact Framework and project references

u Editor underlines (squiggles) classes and methods that are not available

u Web services and Web references fully supported

v Auto-generated proxy

u Additional project properties for device projects

Running Your Application

u Running your application will automatically copy it to the device

u Visual Studio installs the .NET Compact Framework on the device

u Select the deployment device from the device toolbar or project properties

u Emulator will automatically start
if needed

Emulation

u Robust, accurate device emulation

u Runs Windows® CE operating system on Windows XP

u Emulates localized versions of the operating system

u Can add images created in Platform Builder

u Configurable in Device Settings in Tools Options

v Configure RAM availability

v Map PC hardware to the emulator

Debugging

u Supported features include

v On-device debugging from Visual Studio Shell

v Line and Data Breakpoints

v Multi-language debugging

v Call Stack, Watch windows

v Command window – Immediate

u Features Not Supported

v No set next statement

v No native<->managed unified debugging

v No attach to process

Debugging

Application Deployment

u Application install uses Windows CE installer technology

u Visual Studio will auto-generate simple CAB files for device Installer

v Include application and dependant references

v Does not include the runtime or SQL-CE

u Application Install will check for the runtime when installing

u Temporary files are kept if user wants to customize the cab file contents

Windows Forms Support

u Layout

v Manual positioning

u Drawing

v Polygons, lines, arcs, ellipses, rectangles

v JPEG, BMP images

u Text and images

v TrueType bitmap fonts on Mobile

u Most desktop controls

u Designer support

Supported Controls

Button

CheckBox

ComboBox

ContextMenu

DataGrid

DomainUpDown

FileOpenDialog

u Supported controls

Major areas of .NET CF

u Base Classes

u Drawing/Forms

u Data/XML

u XML Web Service Client

Basic Data Types

u Base data types are the same as the desktop

v Formatting

v StringBuilder

v More efficient when string length changes

v Arrays

v Value types (Int16, Int32, Int64, UInt16, etc…)

v Floats and doubles

u Collections

v Classes for storing sets of objects

v Arraylists and Hashtables

Base: Networking

u Sockets

v Synchronous and asynchronous

v Multiple protocols

u Streams

v Built on top
of sockets

v Synchronous
and asynchronous

u HTTP request
and response

v Use stream model

v Requires no user
knowledge of HTTP

Base: Threading

u Applications start with an initial thread

u Applications can start new threads

u Using threads

v Responsive UI

v Program function segregation

u Thread synchronization primitives

u App domains exist until all threads exit

Base: Native Code InterOp

u Managed à native (P/Invoke)

v Calls into existing native code

v .NET Compact Framework does “flat” marshalling of arguments

v Calling COM objects in process

u Native à managed

v P/Invoke and block

Base: Globalization

u Culture-correct String comparison

u Calendar math

u DateTime and numeric formatting and parsing

u External data

v Encodings

u .NET Compact Framework CLR is fully globalized

v Data tables are factored

v Can use Windows CE tables

XML

u XmlTextReader and XmlTextWriter

v Forward-only parsers of XML data

v Better performance, no in-memory caching

v Low memory requirements

u XmlDocument

v Parse entire document

v In memory traversal

v Higher memory requirements; more functionality

Unsupported XML Classes

u XmlDataDocument

v Relational and hierarchical views of XML

u XPath

v Query over unstructured XML data

u XSL/T

v Transform XML data to other forms

u XML Validation

v Verifies correctness of XML document

ADO.NET Support

u Handling data offline with DataSet

u Communicating DataSet with XML

u Common data model from server to PC to device

u Extensible ADO.NET provider model

u Included data providers

v SQL Server (System.Data.SqlClient)

v SQL Server CE (System.Data.SqlServerCe)

Web Services Support

u Calling XML Web Services

u All encoding types

u Synchronous and asynchronous invocation

u Basic and Digest authentication

u Secure Sockets Layer support for encryption (SSL)

u Custom SOAP headers

u SOAP Extension Framework

u Highly Reuse

Application Deployment

Why Not Do An “eVB 4.0”?

u eVB was adequate for quickly building simple applications, but fell short for larger, more complex applications. The next generation of highly network oriented applications will demand even more functionality and new paradigms.

VB .NET Desktop Differences

u Very rich subset, but some limitations

v No Implicit Late Binding

v e.g. Dim x as Object : x.CallFoo()

v No legacy VB style file i/o support

v Use full .NET file i/o

v No hosting ActiveX controls in forms

v No creating ActiveX controls in Visual Basic

VB .NET and C# Native Code Inter-Op

u Managed app can use native code (PInvoke)

v Same syntax as the desktop

v Exposes rich Windows CE APIs

v Automatically marshals simple data types

v High performance, low overhead transitions

u No automatic “COM Inter-Op”

v Create a managed class to wrap the object and native code to call object

u Cannot expose managed code to native code

u Some attributes not supported

Compatibility and Performance

u Compatible with full .NET Framework

v Interoperability, protocols

u Compatible with .NET CF 1.0

v Side-by-side execution

v Application compatibility

u Enhanced performance

v Unified JIT

v Improved string handling

v XML improvements

v Improved ADO.NET with SQL Mobile

Displays and Layout

u Orientation support

v Docking and anchoring

v AutoScroll property – forms, panels

v SuspendLayout and ResumeLayout

v ChangeOrientation – portrait or landscape

u Resolution support

v Automatic scaling

v Graphics

v DpiX

v DpiY

u Data access

v SQL Mobile

v DataGridView

u Textbox IME switching

v InputModeEditor

u Enable multiple menu items on left softkey

u Enhanced VB.NET features

v "My" namespace support

u Enhanced C# features

v Iterators

v Anonymous methods

u Cross language features

v Generics

v Partial classes

New Windows Forms Controls

u DateTimePicker

u MonthCalendar

u DocumentList

u LinkLabel

u Notification

u Help

u WebBrowser

Windows Forms Features

u Clipboard support

u Additional properties, methods and events

v Control.DoubleClick

v ToolBarButton tooltips

v More Treeview events

u Keyboard support

v Form.KeyPreview

v TabIndex, TabStop

System.Xml Namespace

u Improved performance

u Schema validation support

v No DTD Support

u Static creation methods for XmlTextReader and Xm
1923c
lTextWriter

u XML processing through XPath

u XmlSerialization

System.Messaging Namespace

u Support for message queuing

v Send and receive messages

v Inter-application communication without a live connection

v Communication using unreliable connections

v Administer, connect, and monitor network message queues

Future Windows Mobile Platform

Windows Mobile Roadmap

Visual Studio 2005

u Enhanced project wizard

v Target Pocket PC or Smartphone

u Enhanced designers

u Emulator support

v Based on ARM processor

v Save multiple states

u CAB and Setup projects

u Integrated device and emulator
debugging

u Remote tools

v Process viewer, file viewer, heap walker, and more…

Emulators

u Build and test applications without a device

v Requires a network connection or loopback adapter

u Smart device applications
use a variety of
Windows
Mobile based
emulators

u Visual Studio 2005
automates
debugging
and deployment

Native Language Support

u First-class native C++ support

v MFC 8.0

v ATL 8.0

u One IDE for developing both Managed and Native components of an application

v Debug mixed Native/Managed application at the same time

Key Features

u Enhanced services and device support

v Messaging – SMS, POOM, and telephony

v Notifications – signal, connections

v Location and Camera APIs

u Peripherals support

v Microdrives, cameras, keyboards, secondary displays

u Not accessible through the NET CF 2.0

v APIs embedded in operating system

v Accessed through forthcoming SDK

Managed APIs

u Pocket Outlook Object Model (POOM)

v Managed access to PIM objects

v Contacts, tasks, appointments

u MAPI and SMS

v Sending and receiving email and SMS

v Receiving SMS is a filter based system

u Telephony

v Make phone calls

v Display call log

Pocket Outlook
Listing Appointments

SMS Messaging
Sending a Message

u Easier than before

u Similar to Winsock API

u Just create SMS object and send

Location Services
Microsoft Location Server Overview

Location Services
Microsoft Location Server

u Acquires real-time location information from operator networks

v Where am I? Where are my buddies? Where are my assets?

u Complements Microsoft's MapPoint Web Service

u Hosted by your enterprise, not Microsoft

v Enterprise controls security and privacy policy

v Opt-in model

v Allows end-users to become invisible

v End-users receive notifications when they are located

Location Services
Web Service API

u Use to build location-enabled applications

u Used in
conjunction
with MapPoint
Web Service

Notifications Broker
Unified State & Notification Architecture

u Provides light-weight mechanism for storing state

v Device, application, and service state

v Simplified access to state properties

v Extensible architecture for adding third party state properties

u Supports multiple devices

v Pocket PC

v Smartphone

Notifications Broker
Development Scenarios

u Register for notifications

v You choose the notifications to which you respond

u Examples

v Connect to a server when GPRS is available

v Initiate a synchronization event

v When fast connectivity is available

v Synchronize offline store

v When device is cradled

v Persist application settings across sessions

v Respond to low battery notification

v Schedule device management behavior

u Create custom notification events

Summary

Summary

u Leverage your knowledge and build device apps!

v Desktop framework & tools

v .NET languages (C#, VB .NET)

u Choose the appropriate project template

u Compile, Debug, and Deploy in Visual Studio .NET

u Web Information:

v http://msdn.microsoft.com/mobility

v http://www.microsoft.com/mobile

v http://msdn.microsoft.com/smartclient/understanding/netcf/FAQ/default.aspx

u Newsgroup:

v microsoft.public.dotnet.framework.compactframework

u Thanks!

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐