• No results found

Introduction to Windows Mobile Development. Daniel Moth Developer and Platform Group Microsoft UK

N/A
N/A
Protected

Academic year: 2021

Share "Introduction to Windows Mobile Development. Daniel Moth Developer and Platform Group Microsoft UK"

Copied!
27
0
0

Loading.... (view fulltext now)

Full text

(1)

Introduction to

Windows Mobile Development

Daniel Moth

Developer and Platform Group

Microsoft UK

(2)

.NET

Visual Studio

(3)

AGENDA

Same tools, same skills, same code

.NET

Differences of NETCF with Full FX

The Windows Mobile platform

Platform-to-Code

Cross-platform assets

(4)

.NET Through The Ages

2002

2003

2005

2006

200?

Tool

(Visual Studio)

VS .NET 2002

VS.NET 2003

VS2005

VS2005

“Orcas”

Language(s)

VB.NET (v7.0)

C# v1.0

VB.NET (v7.1)

C# v1.1

VB (v8.0)

C# v2.0

as before

C# v3.0

VB9

Framework

Libraries

NetFx v1.0

NetFx v1.1

(NETCF v1.0)

NetFx v2.0

(NETCF v2.0)

NetFx v3.0

NetFx v3.5

(NETCF v3.5)

Engine (CLR)

CLR v1.0

CLR v1.1

(CF CLR v1.0)

CLR v2.0

(CF CLR v2.0)

as before

as before

(CF CLR v3.5)

(5)

.NET Compact Framework

Same IDE

Visual Studio

Same language features

VB and C# only

Smaller class library framework

Approximately 1/20

th

Compact CLR

(6)
(7)

“Framework Compactness”

No...

ASP.NET server

Runtime hosting

Code access security

Binary serialization

Reflection.Emit

Codedom

Configuration

Also No...

WPF

WF

LINQ to SQL

LINQ to Entities

Trimmed namespaces (XSLT), classes (Button.Image),

missing method overloads, etc.

(8)

Classes Specific to NETCF v1.0

Microsoft.WindowsCE.Forms

InputPanel, MessageWindow/Message

System.Net.IrDA

IrDAXXX

EndPoint, Client, DeviceInfo, Listener

System.Data.SqlServerCE

SqlCeXXXX

Command, CommandBuilder, Connection, DataAdapter,

DataReader, Engine, Error, ErrorCollection, Exception,

Parameter, RemoteDataAccess, Replication, Transaction

(9)

Classes Specific to NETCF v2.0

Microsoft.WindowsCE.Forms

HardwareButton

MobileDevice.Hibernate

SystemSettings.ScreenOrientation

DocumentList

Notification

LogFont

Microsoft.WindowsMobile.DirectX

.Direct3D

SqlCeResultSet

For more info:

http://www.danielmoth.com/Blog/2005/08/not-strict-subset.html

(10)

Pictorial View of Versions

Richer

Platform

Capabilities

.NET CF 2.0

MFC 8.0, ATL 8.0

Broad managed

code support

Notification broker,

Location, Camera,

SQL CE, D3DM

.NET CF SP2

VGA (PPC)

QVGA (SP)

Square

Landscape

.NET CF

Enhanced Emulator

Configuration Mgr,

Bluetooth, SMS

MFC 3.0, ATL 3.0

Active Sync

Connection Mgr

MAPI

OBEX

Telephony

MFC 3.0

Win32,

POOM

Better

Development

VS 2005

(C#, VB.NET, C++)

eVC 3

(C++)

eVC 4

(C++)

VS.NET 2003

(C#, VB.NET)

eVC 3

(C++)

eVC 4

(C++)

VS.NET 2003

(C#, VB.NET)

eVC 3

(C++)

eVB 3

(VB)

eVC 3

(C++)

eVB 3

(VB)

Core OS

WinCE 3.0

WinCE 3.0

WinCE 4.2

WinCE 4.2

WinCE 5.0

Device

Choices

Windows Mobile 5

2003

Second Edition

2003

2002

2000

(11)

Windows Mobile 6

Still based on Windows CE 5.0

New Naming scheme

Pocket PC -> Classic

Pocket PC Phone Edition -> Professional

Smartphone -> Standard

Improvements for business and consumer users

For developer

NETCF 2.0 SP1 in ROM

Strong Windows Mobile 5.0 compatibility

(12)

For more info:

http://www.danielmoth.com/Blog/2005/01/desktop-to-ppc-part.html

Windows Mobile vs. Desktop

Input Methods

Form/Dialog size

Navigation between applications

App/Form Closing

Take Over the Device – don’t!

File System

Memory (resource) Constraint

Deployment

(13)

Soft Keys

Input Methods

Smart minimize

Wait Cursor

“I have to understand the

platform!”

(14)

Cross-Platform Assets

Don’t try your desktop binaries on device

TypeLoadException, MissingMethodException

Different PKTs

Retargetable

NETCF binaries can be executed on PC

System.Environment.OSVersion.Platform

Conditional Compilation

Two projects, two outputs, one set of code files

Build platform-specific binaries from same source

(15)

“I can leverage my

existing code!”

(16)

WindowsMobile.Configuration

Configuration Manager

WindowsMobile.Telephony

Initiate phone calls

WindowsMobile.Forms

Contact Picker Dialog

Picture Picker Dialog

Camera Capture Dialog

WindowsMobile.PocketOutlook

Edit Contacts, Appointments,

and Tasks

Control the Messaging application

Send SMS and e-mail messages

Intercept incoming SMS messages

WindowsMobile.Status

Query 100+ system properties

Get notified of changes

Windows Mobile 5.0 / 6

Windows Mobile managed APIs

Part of the platform, not part of NETCF

Can be used by all versions of the NETCF

(17)

State & Notification Broker

POOM

(18)

Summary

Get a Windows Mobile device

Write NETCF applications…

Mobility is taking off rapidly!

(19)

Resources

Blogs, e.g. Mine

http://www.danielmoth.com/Blog

Newsgroups

http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.p

ublic.dotnet.framework.compactframework

Forums

http://forums.microsoft.com/msdn/default.aspx?ForumGroupID=11

Libraries

Mobile Client Software Factory

http://msdn.microsoft.com/mobileclientfactory

(20)

Book

Soon to be released

http://www.danielmoth.com/Blog

From Microsoft Press

“Mobile Development Handbook”

(21)

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

(22)

Backup Slides

(23)

Compact CLR

Garbage Collector

Mark and sweep (not generational)

Three phases: Simple, Compact, Full

Triggered by:

Allocation failure

App goes to background

1MB allocation in current versions (750KB in v1.0)

JIT

Pitching

No ngen

(24)

Learn from Smartphone Model

Entirely Keyboard driven

D-Pad (Left, Right, Up, Down, Enter)

Good use of Soft Keys are crucial

Controls are stacked

Label, LinkLabel, CheckBox, ComboBox, TextBox,

DateTimePicker

TabIndex, TabStop

...or full screen

(25)

Common Language Runtime

Where does garbage come from?

Unnecessary string copies

Strings are immutable

String manipulations (Concat(), etc.) cause copies

Use StringBuilder

http://weblogs.asp.net/ricom/archive/2003/12/02/40778.aspx

String result = "";

for (int i=0; i<10000; i++) {

result +=

".NET Compact Framework";

result += " Rocks!";

}

StringBuilder result =

new StringBuilder();

for (int i=0; i<10000; i++){

result.Append(

".NET Compact Framework");

result.Append(" Rocks!");

}

(26)

.stat

counter total last datum n mean min max

Total Program Run Time (ms) 11843 - - - -

-App Domains Created 1 - - - -

-App Domains Unloaded 1 - - - -

-Assemblies Loaded 2 - - - -

-Classes Loaded 175 - - - -

-Methods Loaded 198 - - - -

-Closed Types Loaded 0 - - - -

-Closed Types Loaded per Definition 0 0 0 0 0 0

Open Types Loaded 0 - - - -

-Closed Methods Loaded 0 - - - -

-Closed Methods Loaded per Definition 0 0 0 0 0 0

Open Methods Loaded 0 - - - -

-Threads in Thread Pool - 0 2 0 0 1

Pending Timers - 0 2 0 0 1

Scheduled Timers 1 - - - -

-Timers Delayed by Thread Pool Limit 0 - - - -

-Work Items Queued 1 - - - -

-Uncontested Monitor.Enter Calls 2 - - - -

-Contested Monitor.Enter Calls 0 - - - -

-Peak Bytes Allocated (native + managed) 3326004 - - - -

-Managed Objects Allocated 60266 - - - -

-Managed Bytes Allocated 5801679432 28 60266 96267 8 580020

Managed String Objects Allocated 20041 - - - -

-Bytes of String Objects Allocated 5800480578 - - - -

-Garbage Collections (GC) 4912 - - - -

-Bytes Collected By GC 5918699036 1160076 4912 1204946 597824 1572512

Managed Bytes In Use After GC - 580752 4912 381831 8364 580752

Total Bytes In Use After GC - 1810560 4912 1611885 1097856 1810560

GC Compactions 0 - - - -

-Code Pitchings 0 - - - -

-Calls to GC.Collect 0 - - - -

-GC Latency Time (ms) 686 0 4912 0 0 16

Pinned Objects 0 - - - -

-Objects Moved by Compactor 0 - - - -

-Objects Not Moved by Compactor 0 - - - -

-Objects Finalized 1 - - - -

-Boxed Value Types 3 - - - -

-Process Heap - 278 235 2352 68 8733

Short Term Heap - 0 278 986 0 10424

JIT Heap - 0 360 12103 0 24444

App Domain Heap - 0 1341 46799 0 64562

GC Heap - 0 35524 2095727 0 3276800

Native Bytes Jitted 22427 140 98 228 68 1367

Methods Jitted 98 - - - -

-Bytes Pitched 0 0 0 0 0 0

Methods Pitched 0 - - - -

-Method Pitch Latency Time (ms) 0 0 0 0 0 0

Exceptions Thrown 0 - - - -

-Platform Invoke Calls

0 -

-

-

-

-Managed String Objects Allocated

20040

Garbage Collections (GC) 4912

Bytes of String Objects Allocate 5,800,480,574

Bytes Collected By GC 5,918,699,036

GC latency

107128 ms

String result = "";

for (int i=0; i<10000; i++) {

result += ".NET Compact Framework";

result += " Rocks!";

}

(27)

counter total last datum n mean min max

Total Program Run Time (ms) 11843 - - - -

-App Domains Created 1 - - - -

-App Domains Unloaded 1 - - - -

-Assemblies Loaded 2 - - - -

-Classes Loaded 175 - - - -

-Methods Loaded 198 - - - -

-Closed Types Loaded 0 - - - -

-Closed Types Loaded per Definition 0 0 0 0 0 0

Open Types Loaded 0 - - - -

-Closed Methods Loaded 0 - - - -

-Closed Methods Loaded per Definition 0 0 0 0 0 0

Open Methods Loaded 0 - - - -

-Threads in Thread Pool - 0 2 0 0 1

Pending Timers - 0 2 0 0 1

Scheduled Timers 1 - - - -

-Timers Delayed by Thread Pool Limit 0 - - - -

-Work Items Queued 1 - - - -

-Uncontested Monitor.Enter Calls 2 - - - -

-Contested Monitor.Enter Calls 0 - - - -

-Peak Bytes Allocated (native + managed) 3326004 - - - -

-Managed Objects Allocated 60266 - - - -

-Managed Bytes Allocated 5801679432 28 60266 96267 8 580020

Managed String Objects Allocated 20041 - - - -

-Bytes of String Objects Allocated 5800480578 - - - -

-Garbage Collections (GC) 4912 - - - -

-Bytes Collected By GC 5918699036 1160076 4912 1204946 597824 1572512

Managed Bytes In Use After GC - 580752 4912 381831 8364 580752

Total Bytes In Use After GC - 1810560 4912 1611885 1097856 1810560

GC Compactions 0 - - - -

-Code Pitchings 0 - - - -

-Calls to GC.Collect 0 - - - -

-GC Latency Time (ms) 686 0 4912 0 0 16

Pinned Objects 0 - - - -

-Objects Moved by Compactor 0 - - - -

-Objects Not Moved by Compactor 0 - - - -

-Objects Finalized 1 - - - -

-Boxed Value Types 3 - - - -

-Process Heap - 278 235 2352 68 8733

Short Term Heap - 0 278 986 0 10424

JIT Heap - 0 360 12103 0 24444

App Domain Heap - 0 1341 46799 0 64562

GC Heap - 0 35524 2095727 0 3276800

Native Bytes Jitted 22427 140 98 228 68 1367

Methods Jitted 98 - - - -

-Bytes Pitched 0 0 0 0 0 0

Methods Pitched 0 - - - -

-Method Pitch Latency Time (ms) 0 0 0 0 0 0

Exceptions Thrown 0 - - - -

-Platform Invoke Calls

0 -

-

-

-

-.stat

Managed String Objects Allocated 56

Bytes of String Objects Allocated 2097718

Garbage Collections (GC) 2

Bytes Collected By GC

1081620

GC Latency

21 ms

StringBuilder result = new StringBuilder();

for (int i=0; i<10000; i++){

result.Append(".NET Compact

Framework");

result.Append(" Rocks!");

}

References

Related documents

Microsoft Windows Media Player 10 Microsoft Windows Media Player 11 Microsoft Windows Media Player 12 Microsoft Windows Movie Maker Microsoft Windows Phone 8 Microsoft

Information about the directors and executive officers of Berkshire is set forth in the proxy statement for Berkshire’s 2014 annual meeting of stockholders, as filed with the SEC on

In fact, 61% of the total number of complaints received from Quebec consumers last year involved Code Clause 14 (Unacceptable Depictions and Portrayal), while 23% involved

Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy

The 30-unit Master of Arts degree in Education with an option in Curriculum and Instruction (MAE-. C&amp;I) is designed for teachers and other professionals who desire advanced study

The highest volatility occurs on Monday for Denmark, Germany, Italy, Netherlands, Sweden and Switzerland; on Tuesday for Belgium and Greece; on Wednesday for

Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy

98 Box Of Misc Glass And China Incl A Retro Coffee Set. 99 Box Of Vintage Trays Etc Incl Large