39
.NET Compact Framework .NET Compact Framework Per Ahlberg

NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Embed Size (px)

Citation preview

Page 1: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

.NET Compact Framework.NET Compact Framework

Per Ahlberg

Page 2: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentEmulation and deployment

Communication and data

Security

Page 3: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentEmulation and deployment

Communication and data

Security

Page 4: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

The Mobile Device UniverseThe Mobile Device Universe

Infrastructure Servers, e.g. Network Operators

ToolsXML Web Services

Clients

Use

r Exp

erie

nce

s & S

olu

tion

sAuthentication SMS Voice CallsSubscriber DBMMS Data CallsPersonalization Billing etc…

Page 5: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

A large number of devices…A large number of devices…

Page 6: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

codeweb pages

Visual Studio.NET 2003Visual Studio.NET 2003

.NET Framework.NET Framework

Mobile Web Browser

Mobile Web Browser

.NET CompactFramework

.NET CompactFramework

client-sideapplications

webapplications

Application models for devicesApplication models for devices

Page 7: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Making Applications MobileMaking Applications Mobile

Mobility involves more than just being wireless

Truly mobile applications go anywhere

Data useful when offline

State of connectedness transparent to user and/or application

Page 8: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

.NET CF design goals.NET CF design goals

CompatibilityStrict compatibility with .NET Framework

Subset functionality

Subsetting for devicesGive the developer a known target

Enable skills andcode transfer

Size/functionality

Provide critical mass needed for “real apps”

.NET Compact .NET Compact FrameworkFramework

.NET Framework.NET Framework

Page 9: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

.NET Compact Framework.NET Compact Framework

Lightweight version of .NET Framework

Designed for resource-constrained devices

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

Runs applications securely on-deviceHigh performance JIT compiler

Guarantees robustness and security

Highly interactive, offline, and networked experiences

Makes it easy to consume web services

Tuned for size and performance

Page 10: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

System

System.Data System.Xml

System.Web

Globalization

Text

Security

Collections

Resources

Reflection

Net

IO

Threading

Diagnostics

ServiceProcess

Configuration

Design

ADO.NET SqlClient

Xslt/XPath

XmlDocument

RuntimeInteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

ServicesDescription

Discovery

Protocols

UIHtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.WinForms

Design ComponentModel

Reader/Writers

.NET Framework.NET Framework

Page 11: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

System

System.Data System.Xml

System.Web

Globalization

Text

Security

Collections

Resources

Reflection

Net

IO

Threading

Diagnostics

ServiceProcess

Configuration

Design

ADO.NET

SqlServerCe

SqlClient

Xslt/XPath

XmlDocument

RuntimeInteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

ServicesDescription

Discovery

Protocols

UIHtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.WinForms

Design ComponentModel

Reader/Writers

.NET Compact Framework.NET Compact Framework

Page 12: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

.NET CLR Common Features.NET CLR Common Features

Verifiable type safe executionNo uninitialized variables, unsafe casts, bad array indexing, bad pointer math

Garbage CollectionNo ref-counting, no leaks

JIT compilation

Error handling with exceptions

Common type systemCall, inherit, and source-level debug across different languages

Page 13: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

.NET CF CLR Differences.NET CF CLR Differences

COM InteropGood support for calling native DLLsSupport for calling a COM object through DLL wrappersNo support for writing a COM / ActiveX object in C# or Visual Basic

No install-time JIT (nGen)No remoting

Client web services is fully supported

No generic serializationDatasets can be serialized to XML

Subsets of other areas of functionality…

Page 14: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentEmulation and deployment

Communication and data

Security

Page 15: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Base data types are the same as the desktop

Formatting

StringBuilder

Arrays

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

Floats and doubles

Collections Classes for storing sets of objects

Arraylists and Hashtables

Basic Data TypesBasic Data Types

Page 16: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

NetworkingNetworking

Common Language Runtime

.NET Compact Framework

Web Services

HTTP Request/Response, Network Stream

Sockets

Applications

SocketsSynchronous and asynchronous

Multiple protocols

StreamsBuilt on top of sockets

Synchronous andasynchronous

HTTP request and response

Use stream model

Page 17: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

ThreadingThreading

Applications start with an initial threadApplications can start new threadsUsing threads

Responsive UIProgram function segregation

Thread synchronization primitives

Page 18: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

GlobalizationGlobalization

Culture-correct string comparison

Calendar math

DateTime and numeric formatting /parsing

External dataEncodings

.NET CF CLR is fully globalized

Page 19: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Windows Forms SupportWindows Forms Support

LayoutManual positioning

DrawingPolygons, lines, arcs, ellipses, rectangles

JPEG, BMP images

Text and imagesTrueType bitmap fonts

Most desktop controls

Designer support

Page 20: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Supported ControlsSupported Controls

Button

CheckBox

ComboBox

ContextMenu

DataGrid*

DomainUpDown

FileOpenDialog

Supported controls HScrollBar

ImageList

Label

ListBox

ListView

FileSaveDialog

MainMenu

NumericUpDown

Panel

PictureBox

ProgressBar

RadioButton

GroupBox RichTextBox NotificationBubble

Print Controls

StatusBar

TabControl

TextBox

Timer

ToolBar

TreeView

VScrollBar

Unsupported controls

Unsupported controls – not available in CECheckedListBo

x

ColorDialog

ErrorProvider

HelpProvider

LinkLabel

NotifyIcon

ToolTip

Splitter

FontDialog

Page 21: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

DataData

ADO.NETDataSet

Databound controls

Managed providers

SQL Server for Windows CE

SQL Server (remote connection)

Page 22: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

XMLXML

XmlTextReader and XmlTextWriter

Forward-only parsers of XML data

Better performance, no in-memory caching

Low memory requirements

XmlDocumentParse entire document

In memory traversal

Higher memory requirements; more functionality

Page 23: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Unsupported XML ClassesUnsupported XML Classes

XmlDataDocumentRelational and hierarchical views of XML

XPathQuery over unstructured XML data

XSLTTransform XML data to other forms

XML ValidationVerifies correctness of XML document

Page 24: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Web Services For DevicesWeb Services For Devices

Web ServicesSynchronous and asynchronous invocationHTTP/SOAPSupport calling into web services

Why?Rich local UIAggregate servicesCache data locally for offline use

Important considerationsBandwidth (How much? 802.11 or WWAN?)Use suitable subset of types

Page 25: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

AgendaAgenda

.NET CF vs .NET Framework

Major AreasBase Classes

Drawing/Forms

Data/XML

Web Services

Application DevelopmentDeployment and emulation

Communication and data

Security

Page 26: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Application DeploymentApplication Deployment

Application install uses Windows CE installer technology

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

Include application and dependant references

Does not include the runtime or SQL-CE

Application Install will check for the runtime when installing

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

Page 27: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Framework SizeFramework Size

Framework size (RAM or ROM)~1.5 MB

Running RAM needs0.5 MB+ (depends on app)

Typical application sizes5 - 100 KB

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

Page 28: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

EmulationEmulation

Robust, accurate device emulation

Runs Windows® CE/PocketPC 2002 operating system on Windows XP

Emulates localized versions of the operating system

Can add images created in Platform Builder

Configurable in Device Settings in Tools Options

Configure RAM availability

Map PC hardware to the emulator

Page 29: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

.NET Framework.NET Compact Framework

ActiveSync

File ReplicationDataSet XML

ADO.NET

WindowsForms

DataSet XML

ADO.NET

Service

ConsBound to single PC for data transfer

No synchronization model; works best with flood synchronizing

ProsGood for casually connected applications

Back end agnostic

Local caching for offline

Active Sync ReplicationActive Sync Replication

Page 30: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

SQL Server

Windows Server

ADO.NET

Data Provider.NET Compact

Framework

ADO.NET

WindowsForms

ConsMust be constantly connected

Not scalable on server; classic “two tier” design

No synchronization model for typical dynamic data

ProsRich query into a large data source

Access to entire data source; device queries for and uses what’s relevant

Direct Database AccessDirect Database Access

Page 31: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Database

ADO.NET

ASP.NET

.NET Framework.NET Compact Framework

XML Web

Service

ConsComplex state and synchronization logic gets unwieldy

Carries bulk of XML data transfer

ProsWell deployed infrastructure (HTTP)

Information cached; Synchronization logicon server

Device communicates directly with source;no PC bridge

Local Data

WS Client

WindowsForms

Web Service ApplicationWeb Service Application

Page 32: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

SQL CE

Replication (HTTP).NET Compact

Framework

SQL CE

ADO.NET

WindowsForms

SQL Server

Windows Server

ConsServer configuration required

Engine footprint on device

ProsVery robust local store

Complex SQL querying

Advanced/performant synchronization

Utilizes HTTP

SQL CE With ReplicationSQL CE With Replication

Page 33: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Database

ADO.NET

ASP.NET

.NET Framework.NET Compact Framework

XML Web

Service

SQL CE

WS Client

WindowsForms

Web Service with SQL CEWeb Service with SQL CE

ConsCarries bulk of XML data transfer

Mapping of XML to SQL CE

Footprint considerations

ProsWell deployed infrastructure (HTTP)

Information cached

Structured storage

Secure storage ofsensitive information

Page 34: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

DataSets on DevicesDataSets on Devices

In-memory cache of a relational database

Aggregating multiple sources

Reading and writing XML

Remoted between tiers with XML Web Services

Foundation for consistent data model from server tiers, desktop applications and now devices

Page 35: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

Data ProvidersData Providers

Providers included with .NET CFSystem.Data.SqlClient

System.Data.SqlServerCe

Custom Data ProvidersFollow interfaces to provide connection to custom data sources

Developer creates custom code translating remote structure to DataSet

Page 36: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

SecuritySecurity

While transferring dataHTTP authentication

Secure sockets

No encryption for System.Data.SqlClient

While persisting dataSQL Server CE

Devices have the habit of disappearing; design for it

No caching of passwords

Encrypt sensitive data – SQL Server CE

Page 37: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

When to choose?When to choose?

Windows CE .NETSupports the Win32 API

Will support .NET Compact Framework

Consider Win32 API when…Low-level driver code

Operating system extensions

Legacy code

Combination will serve you wellLeverage PInvoke

http://msdn.microsoft.com/library/en-us/dncenet/html/choose_api.asp

Page 38: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development

SummarySummary

Leverage your knowledge: Build device apps!

Desktop framework & tools

.NET languages (C#, VB .NET)

Choose the appropriate project template

Compile, debug, and deploy in Visual Studio .NET 2003Internet

http://msdn.microsoft.com/vstudio/device

http://gotdotnet.com/team/netcf/

msnews.microsoft.commicrosoft.public.dotnet.framework.compactframework

Page 39: NET Compact Framework Per Ahlberg. Agenda.NET CF vs.NET Framework Major Areas Base Classes Drawing/Forms Data/XML Web Services Application Development