Title: .Net Compact Framework
1.Net (Compact) Framework
2Outline
- Introduce .Net Compact Framework
- Features
- Controls
- Issues in UI Design
- Sample Application
3Product Framework
Bring device developers to .NET
.NET Knowledge Transfer
- Consistent API behavior
- Visual Studio best tool
- C, Visual Basic
Rich Class Libraries
IT Interop
- Networking
- XML Databases
- Durable messaging
- Developer productivity
- Ease of use
- Robustness
Windows CE
- Compatibility with native security
- Full integration with native setup
- Native code interop
Bring .NET developers to devices
4.NET Compact Framework
Visual Studio
5.NET Framework And.NET Compact Framework
- Both
- Modern, managed runtime environments
- Greatly enhance developer productivity
- Provide both C and VB.NET languages
- Major releases in Visual Studio
- Full .NET Framework
- Extremely rich, scalable, secure, powerful
- .NET Compact Framework
- Preserves essence of full .NET Framework
- Optimized for small size, portability
More languages available from 3rd parties and
on full .NET Framework
6Smaller Yet Compatible
- 28 of the surface area in 8 of the size
- Omitted
- Server functionality
- ASP.NET
- Remoting
- Code Access Security
- Reflection Emit (scripting)
- Individual properties, methods, events classes
factored at member level - Managed C, J
86 scope of Full .NET Framework
Copy
Ground-up rewrite
Snapshot Modify
Execution Engine JIT, GC, Loader, assembly cache
System.Threading
Microsoft.Win32.Registry
System.Text.Regex
System.Collections
System.Xml
System.Generic.Collections
System.IO
System.Cryptography
System.Data
Microsoft.DirectX.Direct3DMobile
System.Resources
System.IO.Ports
System.Messaging
System.Net
System.String
Windows.Forms
91 scope of Full .NET Framework
Microsoft.VisualBasic
System.Text
System.Drawing
System.Globalization
System.Web.Services
7Compatibility
- Applications written using prior versions of the
.NET Compact Framework just work on new versions - Goal is full backward compatibility
- We support SxS as a fallback, but we aim for this
to be unneeded - New versions of .NET Compact Framework run on
previous versions of Windows CE and Windows
Mobile - Windows Mobile support policy n-2
- Windows CE support policy n-1
8Generics
- Classes and methods that work similarly on values
of different types - Variables are specific types, not objects
- No casting required
- Benefits
- Re-use common code
- Find bugs at compile time
class StackltTgt private T store
private int size public Stack()
store new T10 size 0
public void Push(T x) // push code goes
here public T Pop()
return store--size void Add(Stackltintgt
s) int x s.Pop() int y s.Pop()
s.Push(xy)
9More New C Language Features
- Anonymous Methods Code blocks encapsulated in a
delegate
Before
After
// in constructor button.Click new
EventHandler(ProcessClick) // separate
method void ProcessClick(object sender,EventArgs
e) // increment a counter or other action
// in constructor button.Click new
EventHandler(sender,args) // increment a
counter or other action
- Partial Types Split definitions for types and
class members across multiple files - C compiler combines all definitions to make a
single class
Foo-Part2.cs
Foo-Part1.cs
10VB.NET
- Easiest and most productive way to develop .NET
applications - .NET Compact Framework continues to support
VB.NET - New support for a subset of VB.NET My namespace
- My.Resources
- My.WebServices
- My.Forms
11Rich Controls
Pocket PC
12DateTimePicker
13DocumentList
14Notification Bubble
15UserControl
- Easily build and reuse your own custom controls
- Well integrated into design time experience
16MonthCalendar
17LinkLabel
18More Controls
- MonthCalendar
- LinkLabel
- Help
- WebBrowser
- DataContainer
- New on Smartphone
- Datagrid
- Textbox IME switching
- Enable multiple menu items on left softkey
19Forms And Drawing
- More Keyboard Support
- Events
- Form.KeyPreview
- Tabs
- Clipboard support
- Drawing
- Bitmaps (including save as)
- Rotatable fonts
- Custom Pens
- Control.Handle retrieve window handle
- Lots of additional properties, methods, events
20Displays And LayoutSupport for new and future
devices
- Orientation Support
- ChangeOrientation method
- Docking and Anchoring
- AutoScroll property forms, panels
- Suspend/Resume Layout methods
- Resolution Support
- Automatic scaling
- Graphics DpiX/DpiY
21Managed D3D Mobile
- Included in WinCE 5.0 and future versions of
Windows Mobile - Native API is DX8 inspired
- Managed APIs are DX9 inspired
- Features
- Complete access to the underlying native D3DM
API - Fixed point support (Vertex Data, Matrices,
Lights, and Materials) - Sprite
- Font
- Mesh
- TextureLoader
- Tutorials and Samples
Related session CLI317 Game Development Using
Managed Direct3D Mobile with the .NET Compact
Framework
22Base Class Libs, Networking, Web Services
- Serial Port
- Four ports
- Supported in the emulator
- IPv6
- Generic-based collections classes
- Leverage the power of new Generics language
feature - Web services
- Faster XmlSerializer
- Support for SOAP 1.2
23Data And Xml Class Libraries
- System.Data
- Powerful data designer tools integrated into
Visual Studio 2005 - SQL Mobile 2005
- Available with Visual Studio 2005 (or as
download) - Smartphone support!
- SqlCeResultSet (Updateable scrollable cursor)
- Storage Engine - Multi-User and Multi-Connection
support - Many ADO.NET features added to track full .NET
Framework - System.Xml
- Serialization of live objects like application
settings - Schemas
- Validate XML against schema constraints
- Generate schemas on the fly programmatically
- XPath 1.0
24System.Messaging (MSMQ)
- Use for bi-directional communications over
intermittent (unreliable) connections
.NET Compact Framework Application
Smart Device
Server Application
Operating System Message Queue
Data transferred whenconnection
available. Device application does not need to be
running.
Note Can be used for Inter-Process
communications also
Related session CLI321 Using MSMQ to Build
Reliable Mobile Applications
25PIM And Telephony Classes
- New in Windows Mobile 2005
- Pocket Outlook Object Model (POOM)
- Appointments, contacts, tasks
- Phone initiate calls
- Messaging Email and SMS
- State Notification
Related session CLI318 New Managed Messaging,
State, and Notification APIs in Windows Mobile
26Windows Mobile User Interface Design
27Windows Mobile UI DesignGeneral concepts
- Many familiar concepts
- Mouse stylus
- Keyboard hardware buttons
- What makes your app mobile?
- Keep in mind that user input is always a pain
- Keep UI simple
- Think about 5 minute bursts of activity
28Screen OrientationWhat is it?
Landscape
Square
Portrait
29Screen OrientationDesign considerations
- User can rotate at runtime
- Three main strategies
- Resize content
- Relayout content
- Change content
- Keep user experience intact
30Screen OrientationApplication UI
Technique 1 Resize your content
31Screen OrientationApplication UI
Technique 2 Relayout your content
32Screen OrientationApplication UI
Technique 3 Change your content
33Screen OrientationDialog strategies
- Design for square screen
- Dynamic relayout
34Screen OrientationDialogs
Strategy 1 Design for square screen
35Screen OrientationDialogs
Strategy 2 Dynamic relayout
36Screen OrientationNative code
- Swap dialog templates
- DRARelayoutDialog
- Relayout at runtime
- WM_SIZE
- Handle rotation
- WM_SETTINGCHANGE
- DRAGetDisplayMode
37Screen OrientationManaged code
- Use control anchors
- No code required with .NET CF 2.0!
- Relayout at runtime
- Form.OnResize
- Handle rotation
- Status.SystemState.DisplayRotation
38Screen OrientationOverall design issues
- Dont overcrowd your UI
- Break information into multiple screens
- Input panel issues in portrait mode
- Watch out for edit controls
39Screen OrientationInput Panel gotchas
40Screen ResolutionWhat is it?
96 DPI
131 DPI
41Screen ResolutionDesign considerations
- Physical screen size stays the same
- Pixel size gets smaller
- Keep text BIG and readable
- Keep tap targets easy to hit
- Consistent user experience
42Screen ResolutionBitmaps and icons
- Scaling up bitmaps at runtime looks clunky
- Scaling them down is even worse
- Pixels drop out
- Build bitmaps and icons for each DPI you support
43Screen ResolutionCurrent support table
44SoftkeysWhat are they?
Smartphone
Pocket PC
45SoftkeysWhat are they? (Part 2)
- New for Pocket PC
- Well-tested and well-loved on phones
- Why? One-handed navigation
- Brings Pocket PC and Smartphone closer together
46SoftkeysDesign considerations
- SK1 is the most likely user action
- Non-destructive
- SK2 can be an action or a menu
- Keep the menu small
- Dont duplicate SK1 in the menu
- No submenus if at all possible
- Group similar actions together
- Most common actions at the top
47SoftkeysConverting legacy applications
- No toolbar icons
- Softkey menus are typically smaller than Pocket
PC 2003 menus - No New menu
- Softkeys can be tapped on Pocket PC
- Easy access when screen is rotated
48SoftkeysManaged code
- They just work!
- System.Windows.Forms.MainMenu
- Handling softkey commands
- MenuItem.Click event handler
49Device InputDesign considerations
- Single taps, not double taps
- Minimize the number of taps or keys
- Especially for common actions
- Automatic menu accelerator keys
- Support common keyboard shortcuts as applicable
- Cut, Copy, Paste
- Select All
- Bold, Italic, Underline
50Device InputPosture switching
- Design for one-handed navigation
- Keyboard posture
- Softkeys
- Edit controls
- Hardware buttons (including action/enter)
- Stylus posture
- Buttons
- Hyperlinks
- Tap-and-hold context menus
51Sample Application
52Forms
Snapshots
Fax
53(No Transcript)
54(No Transcript)
55ChooseContactDialog contactChooser new
ChooseContactDialog() If (contactChooser.ShowDia
log() DialogResult.OK) // Specify what
happens // if the user selects a // contact
56contactChooser.RestrictContacts CompanyName
\Contoso\ contactChooser.RequiredProperties
new ContactProperty ContactProperty.AllText
Messaging
57Gathering Properties from user only
- Once you have a SelectedContact, call
ShowDialog, after - Set ChoosePropertyOnlyTrue
- Returns SelectedProperty, (typeof
PocketOutlook.Property) and SelectedPropertyValue
, (string) - Must have a valid SelectedContact first!
58(No Transcript)
59SelectPictureDialog picturepicker new
SelectPictureDialog() If (picturepicker.ShowDial
og() DialogResult.OK) // Specify what
happens on a // successful return here
60(No Transcript)
61CameraCaptureDialog camera new
CameraCaptureDialog() If (camera.ShowDialog()
DialogResult.OK) // Specify what happens on
a // successful return here