Rob TiffanySenior Technical Product ManagerMicrosoft Corporation
Accelerating Windows Mobile Line of Business Development
Session Objectives And Takeaways
Session Objective(s): Describe how the Mobile Line of Business Solution Accelerator Kit empowers developers.Dive into and explore the UI, Business, and Data layers of a Windows Mobile application.
Key Takeaways:Be able to recommend the design, development and deployment of mobile line of business solutions to customers looking to mobilize their enterprise.
Mobile LOB Accelerator KitIt’s a mobile supply chain, inventory management, and route delivery application.Based on the .NET Compact Framework 2.0 and SQL Server 2005 Compact Edition.Includes the following:
A running application.SQL Server 2005 database.Over 100 pages of documentation .Visio architecture diagram.Prerequisite installers for .NETCFv2SP1 and SQL Server Compact Edition to support Windows Mobile 5.0 devices.Over 5,000 lines of commented code.
Key Takeaways
Mobile LOB Accelerator KitUI IndependenceError LoggingApplication SettingsApplication layer enforcement Database AccessBusiness EntitiesBusiness ServicesMerge Replication
What’s Covered
Mobile LOB Accelerator KitCustom ControlsGlobal CacheNetwork AvailabilityUser HelpNotification BalloonsMapPoint Web ServiceCAB ProjectSplash Screen
What’s Covered
Rob TiffanySenior Technical Product ManagerMicrosoft Corporation
Let's take a quick tour
Demo
Application Layer EnforcementWhy do this when books and marketing demos tell us to put all the code in the form?
UI designers don’t have to deal with networking, file I/O, or database logic.Business object developers don’t have to concern themselves with UI elements.A mobile app could be moved to the desktop or web just by changing the UI.The database could be swapped with a different data source just by changing the data layer.
Separating the UI, Business, and Data Layer
User Interface LayerServes as a distraction while the application is loading.With Windows Mobile applications it’s often better to perform expensive operations up-front:
Create database connections.Load configuration information.Freshen data via replication.Cache global information.Load the main form.
Splash Screen
User Interface LayerToday’s devices come in all shapes, sizes, resolutions, and orientations that can change on the fly.Child controls can be “Docked” flush against or even fill a parent control.Child controls can also be “Anchored” at a distance to one or more sides of a parent control.Forms and panels can automatically create scrollbars when child controls exist outside the viewable area.
UI Independence
User Interface LayerSometimes the Toolbox doesn’t have the right control for the job.The Hardware Distributor needs a control to capture signatures.Visual Studio 2005 supports:
Creating a control from scratch where you do all the drawing in the OnPaint event like the signature capture control.Aggregating existing controls into a composite control.
Custom Controls
User Interface LayerReduce your training costs by including Help on each screen of your app.
Use a LinkLabel on WM6 Professional.Use a MenuItem on WM6 Standard.
A single HTML file with specially-formatted keywords is all that’s required.
User Help
Help.ShowHelp(this, @“\HardwareHelp.htm#customerservice");
User Interface LayerAn improvement on the standard MessageBox that slowly pops up from the bottom of the screen.Can render HTML to display messages with rich colors, fonts, tables, hyperlinks, and images.Developers can detect when a hyperlink or HTML button has been clicked.
Notification Balloons
Rob TiffanySenior Technical Product ManagerMicrosoft Corporation
Notification Code
Demo
Business Layer“Aka” Business Objects or Domain Objects.Represents something in the real-world like a Customer that has an Address and City:
Customer class, Address property, City property.Constructor to hydrate the Customer class into an object with data contained in the Address and City properties.Relationally speaking, it’s a single row with an Address and City column.
Business Entities
Business Layer“Aka” Domain Model or a set of Domain Objects to group our hydrated Customer objects together.This class inherits from CollectionBase:
Wraps an ArrayList with a strongly-typed interface that only accepts Customer objects.Relationally speaking, you have a Customer table with Address and City columns that contain multiple rows of Customer objects.
Strongly-typed collections support data binding and outperform DataSets.
Custom Collections
Rob TiffanySenior Technical Product ManagerMicrosoft Corporation
Business Entity Code
Demo
Business LayerExecutes requests on behalf of the UI and Data layer.
Business Services
Loads Application Settings from the Configuration FileTells the Database object to Synchronize with
SQL Server
Tells the FileAccess object to Log Errors
Tells the NetAccess object to test for Network Resource Reachability
Tells the Database object to Cache a Connection
Builds SQL Queries
Hydrates Business Objects
Adds Business Entities to Collections
Verifies Login Credentials
Creates Orders
Updates Inventory
Tells the NetAccess object to Retrieve Maps from MapPoint
Saves Signatures as byte arrays for Database Insertion
Business LayerIsn’t the use of global variables frowned upon in object-oriented programming?When you have data that you need to maintain throughout the life of your app:
Database connection strings.Web Service information.Primitives, objects, and collections that need to be fetched frequently thereby boosting performance.
Use the Singleton pattern for your cache class to ensure that only a single instance can exist.
Global Cache
Data LayerHelp your software developers and testers improve your product by logging errors that are thrown while deployed in the field.When your error handling catches errors or collections of errors, use the StreamWriter to log the following to a text file:
Date and TimeError messageStackTrace
Error Logging
Data LayerHow come the Compact Framework doesn’t support application configuration files like the desktop?Use the GetAppSetting and SetAppSetting methods found in the Hardware Distributor to read and write to the XML application configuration file.Supports the “appname.exe.config” format.
Application Settings
<?xml version="1.0" encoding="utf-8" ?><configuration> <appSettings> <add key="InternetUrl" value="http://webserver/ssce/sqlcesa30.dll"/> <add key="InternetLogin" value="NORTHAMERICA\rtiffany"/> <add key="InternetPassword" value=“P@ssw0rd)"/> <add key="Publisher" value=“PubServer"/></appSettings></configuration>
Data LayerMapping objects to a relational database.No, we’re not using DataSets, DataAdapters, TableDirect, or even SqlCeResultSets.Includes support for the following:
Merge replication.Connection caching.Create Read Update Delete functions.“Top” queries.
Database Access
Rob TiffanySenior Technical Product ManagerMicrosoft Corporation
Database Access Code
Demo
Data LayerSometimes you need to pull over and ask for directions.Via easy to use web services, MapPoint allows you to:
Send your start and destination to return a map as a bitmap.Return a route optimized for either speed or distance.
Developers can sign up for a free MapPoint development account and download the SDK.
MapPoint Web Service
Data LayerKnowing “Presence” before you make the call.Wireless data networks are inherently unreliable and can lead to a bad user experience.The State and Notification Broker will let you know when the network is available.If you want to know if your network resource is reachable, use the WebCheck function in the Hardware Distributor.
Network Availability
Cell Tower
Rob TiffanySenior Technical Product ManagerMicrosoft Corporation
WebCheck Code
Demo
Data LayerMicrosoft’s best out-of-the box solution for synchronizing schemas, indexes, referential integrity, and data between Windows Mobile 6 and SQL Server.Through a Hub and Spoke architecture, it tracks changes in the client and server databases and resolves data conflicts.It securely syncs data over firewall-friendly HTTP(S) and utilizes compression and a binary wire protocol for maximum efficiency.
Merge Replication
Data LayerMerge Replication Architecture
Windows Mobile.NETCFv2
SQL ServerCompact Edition
Windows Mobile.NETCFv2
SQL ServerCompact Edition
Cell TowerRouter Firewall ISA 2006
Mobile Gateway
Access Point
Active Directory
IIS/SSCEServer Tools
IIS/SSCEServer Tools
SQL ServerDistributor
SQL ServerPublisher
Windows Mobile.NETCFv2
SQL ServerCompact Edition
DeploymentIn the world of Windows Mobile 6, the primary means of software distribution is via the CAB file.Visual Studio 2005 allows you to add a Smart Device CAB project to your mobile solution.
It detects dependencies, creates shortcuts and registry entries, and deploys your executable, dlls, database, help, custom controls, and configuration XML file.
CAB Project
© 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.
Top Related