Скачать презентацию Mød Microsoft for udviklere arkitekter Smart Скачать презентацию Mød Microsoft for udviklere arkitekter Smart

b5e904981a8b65864311add39668bd21.ppt

  • Количество слайдов: 38

Mød Microsoft – for udviklere & arkitekter Smart klient som mobilapplikation Anders Heick Development Mød Microsoft – for udviklere & arkitekter Smart klient som mobilapplikation Anders Heick Development Manager and Software Architect Hand. Step ah@handstep. com http: //www. handstep. com

Hand. Step u u 5 years focus on mobility Core competencies Ø Ø Ø Hand. Step u u 5 years focus on mobility Core competencies Ø Ø Ø Application development Mobile infrastructure Mobile business strategies

Agenda u u u u u Steps to a successful CF project Synchronization Architectures Agenda u u u u u Steps to a successful CF project Synchronization Architectures Working with SQL CE Compressing your web services UI design and form inheritance 10 things you need to know Extend your apps with Interoperability Tips for portability Tools you can’t do without

Steps to a successful CF Project u u Get Requirements! Iterative development Ø Get Steps to a successful CF Project u u Get Requirements! Iterative development Ø Get the target device Ø Develop a Tap Through to confirm UI Ø Ø Get End User Buy In Early and Often Proof of concept everything Ø Ø Barcode Scanning Printing Ø Ø Data Access, Data Storage Connectivity Options

Architecture u Consider your applications requirements Ø Ø u Does the application need to Architecture u Consider your applications requirements Ø Ø u Does the application need to support both online and offline scenarios Should the code be shared across platforms Decide on a synchronization strategy Ø Ø Ø SQL CE Merge Replication SQL CE Remote Data Access Web Services MSMQ SMS

Synchronization Application User Interface Application Sync Web Services UI Business Layer Application Logic Data Synchronization Application User Interface Application Sync Web Services UI Business Layer Application Logic Data Access Layer SQL Server CE Application Sync High reuse of logic Slower synchronization Data Sync Fast synchronization Low level of logic Data collisions

Data Sync SQL CE Replication u SQL Server replication Ø Merge replication Ø Row Data Sync SQL CE Replication u SQL Server replication Ø Merge replication Ø Row and column filtering Ø Conflict resolution Ø Remote Data Access (RDA) Ø Simpler than merge replication Ø No conflict resolution Ø Pull / Update / Push model Ø 3 rd party Ø i. Anywhere Mobi. Link

Merge Replication u u Based on SQL Server 2000 bi-directional implementation Ideal for mobile Merge Replication u u Based on SQL Server 2000 bi-directional implementation Ideal for mobile use Ø Ø Ø u u Update data on client and/or server Merge and resolve conflict based on server-side rules Easy synchronization when connected Flexible data partitioning: vertical, horizontal, and dynamic Anonymous pull subscriptions Auto Ranged Identity Support – but use GUIDs if possible! Out-of-the-box sync

Remote Data Access (RDA) u u Very simple read/write access to data in remote Remote Data Access (RDA) u u Very simple read/write access to data in remote SQL Server 7 or later Applications can use RDA via three methods: Ø Ø Ø Pull: Client submits SQL query, creating a new table of qualifying rows. Changes made to table can be tracked or non-tracked Push: With tracked changes, Push method sends modified rows back to server and applies them Submit. SQL: Client submits any valid SQL Server SQL statement which is forwarded to SQL Server for execution

SQL CE Limitations u The Database designer Ø u u u Using Merge replication SQL CE Limitations u The Database designer Ø u u u Using Merge replication will help you Single-user only No auto-compacting (reclaim space) No SPs, views Sparse error messages No @@IDENTITY

Database design Query Analyzer vs. Remote SQL CE Database design Query Analyzer vs. Remote SQL CE

Data Access SQL CE Database Compaction u u u Pages are reorganized Database statistics Data Access SQL CE Database Compaction u u u Pages are reorganized Database statistics are updated Change encryption, password Dim eng As New Engine() eng. Local. Connection. String = _ "Data Source=My DocumentsTest. DB. sdf; Password='pass'“ eng. Compact( _ "Data Source=My DocumentsTest. DB. sdf. tmp; Password='pass'“)

SQL CE Futures u u Laguna alias SQL CE 3. 0 alias SQL Mobile SQL CE Futures u u Laguna alias SQL CE 3. 0 alias SQL Mobile 2005 Runtime Improvements: Ø Ø Ø u Performance Re-use spent storage pages Query hints Updateable scrollable cursors. Multi User Tools Ø Ø Ø Integration to Workbench DTS Data Designer in Whidbey

Web Services u Synchronous Ø Ø u Asynchronous Ø Ø u Good for small, Web Services u Synchronous Ø Ø u Asynchronous Ø Ø u Good for small, quick packets of data Blocks the current thread Good for larger packets of data Callback when processing finished Security Ø Ø Recommended to use SSL Digest or Clear Text authentication Currently no support for WSE Custom via SOAP headers

Web Services Considerations u Data size explodes compared to DB sync Ø Ø u Web Services Considerations u Data size explodes compared to DB sync Ø Ø u GSM/GPRS data costs Conserve bandwidth Data Compression Ø Ø No standard data compression exists Client applications need custom coding to be able to exploit.

Data Compression u Server side Ø Ø Ø u Windows 2003 Server Enable compression Data Compression u Server side Ø Ø Ø u Windows 2003 Server Enable compression and gzip. dll via MMC Modify metabase adding asmx to Hc. Script. File. Extensions for gzip and deflate compression filters Client side Ø Ø Ø Need to override Get. Web. Request and Get. Web. Response. NET Compact Framework SP 1 Use Sharp. Zip. Lib Compression Library

Client Data Compression public class Gzip. Proxy : Soap. Http. Client. Protocol { protected Client Data Compression public class Gzip. Proxy : Soap. Http. Client. Protocol { protected override Web. Request Get. Web. Request(System. Uri uri) { Web. Request req = base. Get. Web. Request(uri); } req. Headers. Add("Accept-Encoding", "gzip, deflate"); return req; protected override Web. Response Get. Web. Response(Web. Request req) { return new Compressed. Http. Web. Response(req); } }

Other options u MSMQ Ø Ø u Custom binary interface Ø u Implements asynchronous Other options u MSMQ Ø Ø u Custom binary interface Ø u Implements asynchronous communications Provides guaranteed delivery, efficient routing, priority based messaging. Don’t go there unless you really have to! SMS Ø Great for server initiated sync

Security u Transferring secret data Ø Ø u u Never send as readable – Security u Transferring secret data Ø Ø u u Never send as readable – use a secure channel VPN, MPLS, HTTPS Make data survive a dropped device Encrypt the SQL DB – but only if you have to

UI Design Device Form Factor u 320 X 240 standard resolution Ø Resizing was UI Design Device Form Factor u 320 X 240 standard resolution Ø Resizing was not a problem Ø Break up large forms u Use panels and cache forms u Memory Ø Image sizes Ø Data cached in controls Ø Data. Grid, Tab control, Combobox

UI Design Validation u Validating(), Validated() u CF supports Regular Expressions u System. Text. UI Design Validation u Validating(), Validated() u CF supports Regular Expressions u System. Text. Regular. Expressions. Reg. Ex Ø Regex. Is. Match() if(!Regex. Is. Match(user. Name, "^([a-z. A-Z])+$")) { Message. Box. Show(“User Name is invalid. ”); }

UI Design u u Help the user by auto-showing SIP Resize when showing the UI Design u u Help the user by auto-showing SIP Resize when showing the zip – or use a Popup Panel Design for fingers Designing with form inheritance

Form Inheritance Form Inheritance

UI improvements in Whidbey u u u New high fidelity design experience Device specific UI improvements in Whidbey u u u New high fidelity design experience Device specific Orientation and resolution aware Skins More accurate intellisense User Controls and form inheritance

10 things you need to know but really don’t want to hear about 1. 10 things you need to know but really don’t want to hear about 1. The Emulator sucks u 2. Speed, Active. Sync, States, Network. . . Error: Cannot establish a connection. Be sure the device is physically connected to the development computer. . . u u u Read KB 816826 Proxy. Ports. reg and Del. Desktop. Crypt. Key. exe from Windows CE Utilities for Visual Studio. NET 2003 Add-on Pack 1 Soft-reboot the device

10 things you need to know but really don’t want to hear about 3. 10 things you need to know but really don’t want to hear about 3. Active. Sync performance is not impressive u 4. Best debugging experience is using an ethernet connection Error message are not always what they look like u u Listbox. Items. Clear() -> Argument. Exception Desktop version: ”Cannot modify the Items collection when the Data. Source property is set”

10 things you need to know but really don’t want to hear about 5. 10 things you need to know but really don’t want to hear about 5. . NET CF SP 2 is a must-have u 6. Lots of fixes. And now the List. View auto-size even works. . . Save the Pocket PC Emulator state for real u u If you shutdown emulator without saving state everything is lost In C: Documents and SettingsloginApplication Data look for the. vsv file

10 things you need to know but really don’t want to hear about 7. 10 things you need to know but really don’t want to hear about 7. Guest. Only for multiuser connections u u 8. 9. 10. HKLMSoftwareMicrosoftWindows CE Services Guest. Only , Auto. Start. On. Connect , Auto. Start. On. Disconnect NDoc won’t help you Fx. Cop won’t help you NUnit won’t help you Whidbey WILL help you!

Interoperability u No built-in support u Code wrappers using Platform Invoke u Requires advanced Interoperability u No built-in support u Code wrappers using Platform Invoke u Requires advanced COM programming experience

Interoperability Interoperability

Public Shared" src="https://present5.com/presentation/b5e904981a8b65864311add39668bd21/image-31.jpg" alt="Interoperability Platform Invoke – Process u Add DLLImport. Attribute Public Shared" /> Interoperability Platform Invoke – Process u Add DLLImport. Attribute Public Shared Function Play. Sound( By. Val sz. Sound As String, By. Val h. Module As Int. Ptr, By. Val flags As Integer) As Integer End Function u Call the wrapper Play. Sound(“Windowssome. Sound. wav”, Int. Ptr. Zero, SND_FILENAME) u www. pinvoke. net u Invoke. net Add-In for Visual Studio

Tips for portability u Two separate projects for desktop and device Ø u u Tips for portability u Two separate projects for desktop and device Ø u u u #if is your portability friend Compile against. NET CF first Use minimal code behind forms Ø Ø u Source. Safe will help you Should be only about UI logic Common routines in common modules Lowest common denominator Ø Dynamic SQL - sigh. . .

Hardware Future u Displays Ø Ø u Pocket PC Portrait/Landscape support Pocket PC Square Hardware Future u Displays Ø Ø u Pocket PC Portrait/Landscape support Pocket PC Square Screen Pocket PC VGA Smartphone QVGA Form Factors Ø Ø Hybrid devices Pocket PC softkey support u Multiple-Radios Ø Ø GSM/GPRS CDMA/1 x. RTT Wi. Fi (802. 1 x) Bluetooth Location Services

The Mobile Device Opportunity! Worldwide Mobile Device Shipments (Gartner based) Smart Devices taking off The Mobile Device Opportunity! Worldwide Mobile Device Shipments (Gartner based) Smart Devices taking off 120 103 M data-centric devices will be shipped by 2007 100 80 36 M PDA and PDA phones will be sold in 2007 60 40 2, 154, 246, 090 cellular subscribers World wide by 2007 (EMC World Cellular Database) 20 0 2001 2002 2003 2004 2005 2006 2007 12. 1 13. 4 15. 7 18. 3 20. 2 PDA Phones 1. 2 1. 8 4. 4 7. 4 10. 9 13. 6 16. 3 Smart Phones 1. 9 4. 0 11. 0 19. 0 31. 8 47. 8 66. 9 PDA Source: Gartner, Microsoft Estimates

Tools you can’t do without u u Win. CE Tools C: Program FilesWindows CE Tools you can’t do without u u Win. CE Tools C: Program FilesWindows CE ToolsCommonPlatmanbinwce 420 Pocket Controller Remote SQL CE Lutz Roeder’s Reflector for. NET

Ressources u Patterns & Practices u Remote SQL CE http: //www. gui-innovations. com/ Pocket Ressources u Patterns & Practices u Remote SQL CE http: //www. gui-innovations. com/ Pocket Controller http: //www. soti. net/ Integration with Pocket Outlook http: //www. inthehand. com/ Smart Device Framework www. Open. Net. CF. org u u u http: //msdn. microsoft. com

Ressources u u u Lutz Roeder’s Reflector for. NET http: //www. aisto. com/roeder/dotnet/ Sharp. Ressources u u u Lutz Roeder’s Reflector for. NET http: //www. aisto. com/roeder/dotnet/ Sharp. Zip. Lib Compression Library http: //www. icsharpcode. net Flere events? www. microsoft. dk/msdn/events

Please fill out the evaluation forms © 2004 Microsoft Corporation. All rights reserved. This Please fill out the evaluation forms © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.