Applications Using the

friendlybathΚινητά – Ασύρματες Τεχνολογίες

12 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

80 εμφανίσεις

Developing Mobile
Applications Using the
.NET Compact Framework

A Case Study

Tom Kopcik MCSD, MCDBA, MCTS, MCT

Software Engineer/Trainer

PTSI


Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0



Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0



Resources

Quick Poll

In what year did your
primary

personal computer
have approximately the following specifications:


400 MHz Processor


64 MB RAM


9600 Baud Modem


Storage 22MB





Resources

Quick Poll

In what year did your
primary

personal computer
have approximately the following specifications:


400 MHz Processor


64 MB RAM


9600 Baud Modem


Storage 22MB

This IS a typical resource set for a Pocket PC

The Company


River Valley Foods

Regional food distributor

Stock major frozen food & ice cream brands (2500 SKUs)

Orders were taken via a paper
-
based ‘Order Sheet’
customized to the store/location.

Deliver to major supermarkets, drug stores, and
independents in Upstate New York & Pennsylvania

Before completion of the project, the company acquired
another food distributor with a much broader product
line (50,000+ SKUs). The acquired company was
utilizing an out
-
dated and unsupportable hand
-
held UPC
scanning device for order taking.


Application Objectives

Initial


Automate order taking phase of the sales process.


Maintain chain/location product control in a familiar
format.


Allow communication of orders to the central warehouse
from throughout the entire geographical market including
numerous rural locations.


Minimize hardware & ongoing incremental
communication expense

Post Acquisition


Extend the application to support UPC scanning


Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0



Application Architecture


Initial Phase

Hardware/OS


Pocket PC Application with Compact Framework 1.0


Windows Mobile 2003 OS


Dell Axim Pocket PC (X5, X50,X51)


Use existing cell phones for modem communication
(9600 Baud)

Data Transfer/Storage


Plain Flat Text Files


minimize bandwidth

Application Architecture


Post Acquisition

Hardware/OS


Pocket PC Application with Compact Framework 1.0


Windows Mobile 2003 OS


Intermec Pocket PC with integrated UPC scanner


Phone Modem Communication (9600 Baud)

Data Transfer/Storage


Flat Plain Text Files


File structure extended to support UPC data file with
incremental update.

Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0



Development Environment: Tools

Onscreen Device
Emulators

Visual Studio .NET

Smart Device Extensions

.NET Compact Framework

.NET Framework

For developing rich
client applications
with offline
capability

ActiveSync/

Ethernet

Development Tools

Visual Studio .NET 2003 used in the project

VS 2005 will be discussed later

Pocket PC 2003 SDK

Installation Sequence


uninstall of Visual Studio & related
tools and reinstallation in a prescribed sequence
recommended by Microsoft


violate at your risk!

http://msdn.microsoft.com/library/default.asp?url=/library/en
-
us/dnppcgen/html/devtoolsmobileapps.asp



Installation Sequence

Uninstall all existing tools, SDKs, and emulators before proceeding.

Install the development tools in the correct order:



Install Microsoft ActiveSync 4.0


Install the eMbedded Visual Tools
-

2002 Edition, Pocket PC 2002
SDK, and Smartphone 2002 SDK


Install eMbedded Visual C++ 4.0 and Service Pack 4.



Install Visual Studio .NET 2003.


Install the Pocket PC 2003 SDK & Smartphone 2003 SDK and
emulators


Developer Resources for Windows Mobile 2003 Second Edition


Install Visual Studio 2005.


Install Windows Mobile 5.0 SDKs for PocketPC and/or Smarpthone



Architecture

Common

Language Runtime

Platform Extension Frameworks

.NET Applications

Core Framework

Execution Engine

Application

Domain
Host

…Launch

Platform Adaption Layer

Host Operating System

Host Operating System Services

Hardware

Managed

Native

Class Library Support

System.Windows.Forms

System.Drawing

System.Data

System.Xml

Design

Drawing2D

ADO.NET

XmlDocument

ComponentModel

Text

SqlClient

Readers/Writers

SqlServerCe

System.Web

System.Web.Services

UI

Description

Services

Discovery

Security

Protocols

System

Collections

IO

Security

Net (IrDA classes)

Text

Reflection

Diagnostics

Globalization

Resources

Threading

SQL Server CE

and IrDA classes

only available

in the .NET

Compact

Framework

Key Differences from the .NET Framework

Feature

Limitations of the .NET Compact
Framework

MDI forms

Windows CE does not support Multiple Document
Interface

GDI+

Windows CE does not support GDI+

Drag
-
and
-
drop

Windows CE does not support drag
-
and
-
drop

Printing

Not supported by Windows CE or the .NET
Compact Framework

Compact Framework is a distinct subset of the
overall .NET Framework

Selecting a Target Platform/Target Device

Select a target platform
before selecting a
project template. Once
set, the target platform
cannot be changed for
that project. (VS 2003
only)

Currently supports Windows
Mobile 5.0, Pocket PC (2000,
2002, 2003) , Windows CE .NET
-
based platforms

Demonstration: Pocket PC Application

(Visual Studio 2005)

Set the Target Platform

Set the Target (deployment) Device


Connect to Device

Build CAB File

Deployment Device

Device Options

Demonstration: Pocket PC Application

(Visual Studio 2005)

Hello World/Logon Application

Use Visual Studio 2005

Target Platform: WM 2003


Target Device: Emulator


Target Device: Pocket PC WM 2003

Establish USB Connection

Use ActiveSync Remote Display

Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0



Designing Forms for Usability

Keep the user interface simple


Place frequently used fields at the
top

of the form


Show only the most important controls


Group controls for related tasks

Make labels and prompts short and concise

Limit free text entry on devices with no keyboards

Easy to distinguish controls and icons

Predictable and consistent control functions

Feedback

Soft Input Panel (SIP) Guidelines

Design application so it adjusts windows if user
activates the SIP

If you include custom SIP, give users choice to select it

Place controls where SIP does not hide them

Test application to ensure that it works with SIP

Designing Controls for Stylus Input

Targeting and tapping can be difficult for some users

Provide larger interface targets to make it easier to tap

Provide sufficient space between controls

Consider supplemental audio or visual feedback

Be consistent with touch screen concepts


Single tap


Tap and hold

Debugging a Mobile Device Application

Device and desktop applications share the same
integrated debugger

You can debug applications by using the emulator, or
remotely

actual device runs the application

Remote Debugging

ActiveSync


USB (
ActiveSync 3.x/ or ActiveSync 4.0)

USB ActiveSync connections are notoriously unstable


RemoteSync (Ethernet Connection) (
ActiveSync 3.x
only
)

Must establish USB connection first
.

TCP/IP transport provides better performance



Only

Ethernet Connection option available in
Windows Mobile 5.0/ActiveSync 4.0


Does not require an ActiveSync partnership


Wireless (801.b/g) strongly recommended



Target Platform
CF 1.0
CF 2.0
CF 1.0
CF 2.0
Pocket PC 2000/2
I
WM 2003
X
X
I
MW 5.0
X*
X
I
Visual Studio 2003
Visual Studio 2005
Version Platform Compatibility

X


Compact Framework included in OS

I
-

Compact Framework Installable in OS

* Some literature suggests this is not possible


Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0



Demonstration: River Valley Application

(Visual Studio 2003)

Use Visual Studio 2003

Review Application Architecture

Use USB Connection

Set up TCP/IP connection (Wireless)

CF Subset

Agenda

Application Requirements/Challenges

Solution Architecture

Compact Framework Development Concepts

Best Practices

What’s New in the Compact Framework 2.0/WM5.0



Compact Framework 2.0


What’s New

Smart Devices that have been upgraded to version 2.0 of
the .NET Compact Frameworks will have the following
features:


Performance improvements.


Support for Generic classes.


Support for COM interop.


Improved support for controls.


Support for Direct3D and DirectDraw for Mobile Devices.

http://msdn.microsoft.com/library/default.asp?url=/libr
ary/en
-
us/dnnetcomp/html/whats_new_netcf2.asp


Windows Mobile 5.0
-

New

Managed Assemblies

Direct Managed API


Microsoft.WindowsMobile


Microsoft.WindowsMobile.Configuration


Microsoft.WindowsMobile.Forms


Microsoft.WindowsMobile.PocketOutlook


Microsoft.WindowsMobile.Status


Microsoft.WindowsMobile.Telephony

Independent of Compact Framework

Windows Mobile 5.0


Remote debugging From Visual
Studio 2005

ActiveSync Remote Connections
not

allowed, must use
TCP/IP connection

Also Pocket PC
-
side debugging client tools not deployed
automatically

Copy from Program Files
\
MicrosoftShared
\
CoreCon…


ClientShutdown


CommanClient2


CMaccept

Windows Mobile 5.0


Remote debugging from VS 2005

Run CommanClient2.exe on Pocket PC

Set correct IP Address in Visual Studio

Run CMaccept on PocketPC

Connect to device from Visual Studio within 3 minutes

Subsequent connections from same instance of Visual Studio
should be OK


http://blogs.msdn.com/vsdteam/archive/2005/04/28/413304.aspx



Demonstration: Wireless debugging

(Visual Studio 2005)

Demonstration: Wireless debugging

(Visual Studio 2005)

UPC Scanning Edition

Tried a plug
-
in scanner (SDIO) on the Dell units;
although it worked it would not stand up to field use.

Selected a rugged Pocket PC device from Intermec (4
-
5X
$ of the Dell units) with additional capabilities:


Built
-
in scanner


Keyboard

Basic application moved to the Intermec device with
little or no problems.

Added UPC and keyboard logic to the program

Single program


advanced functionality (UPC,
keyboard) controlled by a configuration file.
-




Developing Mobile
Applications Using the
.NET Compact Framework

A Case Study

Tom Kopcik MCSD, MCDBA, MCT

Software Engineer/Trainer

PTSI