Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Mobile Developer Marcus Perryman Morgan Skinner.

Similar presentations


Presentation on theme: "Windows Mobile Developer Marcus Perryman Morgan Skinner."— Presentation transcript:

1 Windows Mobile Developer Marcus Perryman Morgan Skinner

2 Agenda Development for Native applications Development for Native applications Compact Framework for the Pocket PC Compact Framework for the Pocket PC  Common Requests Smartphone Development Smartphone Development ASP.NET Mobile Controls ASP.NET Mobile Controls Futures – what’s coming next? Futures – what’s coming next? Summary Summary

3 Development for Native Applications

4 Native Code Development Improved Debugging Improved Debugging  JIT debugging (attach to dead process)  Attach to already running process  Multithreaded application debugging Updated Compilers Updated Compilers  SEH and C++ exception handling  STL (Standard Template Library)  Intrinsics (generate in-line code) Updated Remote Tools Updated Remote Tools  Call Profiler  Performance Monitor

5 New Debugging Features

6 Compact Framework

7 The EE A short review Compiled managed code is a binary in Microsoft Intermediate Language Compiled managed code is a binary in Microsoft Intermediate Language Code is just-in-time compiled to the native processor language on type-by-type, method-by-method basis Code is just-in-time compiled to the native processor language on type-by-type, method-by-method basis Resulting native code is cached for later reuse Resulting native code is cached for later reuse Over the lifetime of the app, the up front cost of jitting is amortized, and becomes less and less significant Over the lifetime of the app, the up front cost of jitting is amortized, and becomes less and less significant

8 Under the Hood Build process Build process  Same compilers  Local exe produced – additional Deploy step File format File format  Standard PE format with no native code  Module load upgraded on device  Contains Intermediate Language (IL) blocks  Resources bound in or deployed in parallel Deploy Deploy  Uses Connection Manager not Platform Manager  Again over Active Sync

9 ILDASM Multiple environments

10 .NET Compact Framework System System.DataSystem.Xml System.Web Globalization Text Security Collections Resources Reflection Net IO Threading Diagnostics ServiceProcess Configuration Design ADO.NET SqlServerCe SqlClient Xslt/XPath XmlDocument Runtime InteropServices Remoting Serialization Serialization ConfigurationSessionState CachingSecurity Services Description Discovery Protocols UI HtmlControls WebControls System.Drawing Imaging Drawing2D Text Printing System.WinForms DesignComponentModel Reader/Writers

11 Unsupported Pocket PC NETCF Controls ButtonCheckBoxComboBoxContextMenuDataGridDomainUpDownFileOpenDialog HScrollBarImageListLabelListBoxListViewTreeViewTrackBarFileSaveDialogMainMenuNumericUpDownPanelPictureBoxProgressBarInputPanel GroupBox Printing Controls RichTextBox NotificationBubble (PPC) RadioButtonStatusBarTabControlTextBoxTimerToolBarVScrollBar CheckedListBoxColorDialogErrorProvider HelpProviderLinkLabel NotifyIconToolTip ToolTipSplitterFontDialog

12 Framework Size Framework size (RAM or ROM) Framework size (RAM or ROM)  ~1.5 MB Running RAM needs Running RAM needs  1 MB+ (depends on app) Typical application sizes Typical application sizes  5 - 100 KB  Apps often smaller due to use of platform features in the framework

13 Using the Compact Framework

14 Common Application Features Using Graphics for Business Applications Using Graphics for Business Applications Creating Custom Controls Creating Custom Controls Dealing with Form Management Dealing with Form Management Being Smart about Web Services Being Smart about Web Services

15 Graphics System.Drawing System.Drawing  Supports GDI functions  (line, circle, rectangle etc…)  Good performance  Business application graphics  Wire frame diagrams Games API Games API  No DirectX support (coming soon)  Fast screen access  Sound, hardware buttons

16 More advanced graphics Speed Considerations Speed Considerations  Delayed draw protected override void OnPaint(PaintEventArgs e) { buffer = new Bitmap(Width, Height); Graphics g = Graphics.FromImage(buffer); // … Calculate new position PostRender(g); // Call post rendering routines... g.Dispose(); // Clean up... // Draw to display... e.Graphics.DrawImage(buffer, 0, 0); }  Double buffering  Sprites  Exclusion drawing http://smartdevices.microsoftdev.com/Learn/Articles/660.aspx#netcfgaming_topic4

17 Custom Controls Provides encapsulation and code sharing Provides encapsulation and code sharing No support for User Controls No support for User Controls Derive class from Control: Derive class from Control: public class Visualizer : Control protected override void OnPaint(PaintEventArgs e) Creating the Control: Creating the Control: // Create the 3D warehouse visualizer... this.visualizer = new Warehouse3D(); this.Controls.Add(this.visualizer); Installing to the designer Installing to the designer  Include RuntimeAssemblyAttribute [assembly:System.CF.Design.RuntimeAssemblyAttr ibute”…”)]  Requires desktop build of the control

18 Creating a Custom Control

19 Form Management The Form Flow Challenge The Form Flow Challenge  No Multiple Document Interface  Multi form input more common  Which form to display next?  Hide or destroy current form? Solutions Solutions  Dynamic form construction  Forms manager  Wizard based input (e.g. tight scripting of forms)

20 Form Management Application Kernel Web Service Interface Local Store (SQL CE ) Main FormCollect Form Inspect Form Truck Form Form Manager Main

21 Form Management Lets see some code Lets see some code public sealed class FormsManager { public Form this[AppForms f] { get{}} // Create an instance of the form and cache... Form frm = (Form)asm.CreateInstance(type); cache.Add(type, frm); public void Swap(AppForms f) frm.Show(); // Display the selected form... frm.BringToFront(); nxtfrm.Hide(); // Hide the last form... } MainForm form =(MainForm)FormsManager.Instance[AppForms.MainForm]; form.PrepareForm();

22 Being Smart about Web Services Mobile Communication challenges Mobile Communication challenges  Latency, speed, coverage (we are mobile)  Chatty vs monologue? Consider interface to MapPoint Consider interface to MapPoint  Request the Lat / Long for start and end address FindAddress(startAddress); FindAddress(endAddress)  Request map or driving directions GetMap(mapspec)CalculateSimpleRoute(...) Chatty / State full breaks Store and Forward model Chatty / State full breaks Store and Forward model Monologue ==(?) Performance issues Monologue ==(?) Performance issues Consider a server Agent Consider a server Agent Agent.GetMapData(start,end,GET_MAP | GET_DIRECTIONS)

23 Pocket PC Summary Compact Framework development is very similar to desktop.NET development Compact Framework development is very similar to desktop.NET development Be aware of specific challenges for the mobile device (UI design, communication channel reliability / speed) Be aware of specific challenges for the mobile device (UI design, communication channel reliability / speed)

24 Smartphone 2003

25 Based on Windows CE.NET 4.2 Based on Windows CE.NET 4.2.NET Compact Framework in ROM.NET Compact Framework in ROM  Same classes as Pocket PC  ADO.NET  Web services  Rich Forms Designer  XML Support  Platform Invoke to CE APIs

26 Excluded Supported Smartphone NETCF Controls Label Label TextBox TextBox MainMenu MainMenu CheckBox CheckBox PictureBox PictureBox Panel Panel ComboBox ComboBox ListView ListView TreeView TreeView HScrollBar HScrollBar VScrollBar VScrollBar Timer Timer ProgressBar ProgressBar ImageList ImageList Button Button RadioButton RadioButton ListBox ListBox TabControl TabControl DomainUpDown DomainUpDown NumericUpDown NumericUpDown TrackBar TrackBar ContextMenu ContextMenu ToolBar ToolBar StatusBar StatusBar OpenFileDialog OpenFileDialog SaveFileDialog SaveFileDialog InputPanel InputPanel Unsupported DataGrid DataGrid

27 Missing Controls Multi-Item Picker Multi-Item Picker Date and Time Pickers Date and Time Pickers

28 Smartphone User Interface Follow guidelines within the SDK Follow guidelines within the SDK  Left menu item can only be default action  No pop up menu items (Unsupported Exception)  Right menu item can be pop up  Entry fields should be identified by a Label above the field

29 Input Modes Pocket PC provides Soft Input Panel for data input Pocket PC provides Soft Input Panel for data input Smartphone uses Input Modes Smartphone uses Input Modes

30 Input Modes Input Mode Description EIM_SPELL Also known as multitap EIM_AMBIG T9 predictive text input EIM_NUMBERS Numeric only EIM_TEXT Either Spell or T9, depending on which of these was last used by the user in an edit control with the EIM_TEXT input mode. Use this in edit controls where the user's mode preference is to be used as the default mode. SendMessage(hControl, EM_SETINPUTMODE, 0, EIM_NUMBERS); Need to use Native Interop

31 Native Interop Platform Invoke (P/Invoke) Platform Invoke (P/Invoke)  Call custom native code and Windows APIs  Declare statement in Visual Basic.NET  DLLImport Attribute in C# / Visual Basic.NET  Very flexible  Good support on the device Caveats Caveats  No COM Interop  Marshaling is limited

32 MessageBox int MessageBox( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType ); [DllImport("coredll.dll")] private static extern int MessageBox( IntPtr hWnd, string lpText, string lpCaption, uint uType); Private Declare Function MessageBox Lib "coredll.dll" ( _ ByVal hwndOwner As IntPtr, _ ByVal hwndOwner As IntPtr, _ ByVal lpText As String, _ ByVal lpText As String, _ ByVal lpCaption As String, _ ByVal lpCaption As String, _ ByVal uType As Integer) As Integer ByVal uType As Integer) As Integer

33 MessageBox 1.Loads and initialises coredll.dll 2.Locates the entry point MessageBox 3.Calls into the unmanaged code 4.Completes and returns back to managed code using System.Runtime.InteropServices; [DllImport("coredll.dll")] private static extern int MessageBox( IntPtr hWnd, string lpText, string lpCaption, uint uType); MessageBox(IntPtr.Zero, "Hello World!", "Interop1", 0);

34 Smartphone Input Modes

35 Interop Warnings Some data types require manual marshalling Some data types require manual marshalling  Nested reference types  Unsafe code in C#  Wrapper DLL in C++ Handling of HWNDs is unsupported Handling of HWNDs is unsupported  Forwards compatibility is not guaranteed

36 Scrolling Forms Used for larger amounts of data entry Used for larger amounts of data entry Automatic for native applications Automatic for native applications  Create dialog to be longer than screen  Ensure vertical scrollbar is enabled No automatic support in managed code No automatic support in managed code  Implement using a Panel and VScrollBar

37 Scrolling Downwards Scrolling down should fit the next control on the bottom of the form Scrolling down should fit the next control on the bottom of the form

38 Scrolling Upwards Scrolling upwards should fit the previous control at the top of the form Scrolling upwards should fit the previous control at the top of the form If the control has a label identifier, this should be at the top of the form If the control has a label identifier, this should be at the top of the form

39 Scrolling Forms

40 Owner Drawn ListViews Use to display complex data Use to display complex data Multiple lines / columns Multiple lines / columns Icons / Bitmaps Icons / Bitmaps Respond to key presses Respond to key presses Implemented as a custom control Implemented as a custom control

41 Owner Drawn ListViews Derive from Control class Derive from Control class OnKeyDown to trap current selection OnKeyDown to trap current selection OnPaint for custom draw routine onto Bitmap object OnPaint for custom draw routine onto Bitmap object Control OwnerDrawnList BitmapVScrollBarOnKeyDownOnPaint

42 Owner Drawn Listview

43 Smartphone 2003 UI.NET Compact Framework enables rapid development.NET Compact Framework enables rapid development 14 Inbuilt Controls for rich user interface 14 Inbuilt Controls for rich user interface Extensible using custom controls Extensible using custom controls Workarounds for Input Modes, Scrolling and Owner ListViews Workarounds for Input Modes, Scrolling and Owner ListViews

44 ASP.NET Mobile Controls Enable web content optimized for Mobile Devices Enable web content optimized for Mobile Devices Over 200 devices supported Over 200 devices supported Extensible for new devices Extensible for new devices

45 Mobile Web Versus Rich Client Mobile Web Mobile Web  Broad device support  Online  Server side logic  Browser-based UI  No client installation ASP.NET Mobile Controls (Mobile Internet Toolkit) ASP.NET Mobile Controls (Mobile Internet Toolkit) Mobile rich client Mobile rich client  Target rich clients  Offline and Online  Client side logic and data  UI flexibility  Client side installation Smart Device Extensions and.NET Compact Framework Smart Device Extensions and.NET Compact Framework XML Web Services and Data Access Visual Studio.NET

46 Key Concepts Adaptive rendering Adaptive rendering  Mobile controls and device adapters automatically generate an appropriate rendering for each device Customization Customization  Programmatic model to customize the rendering for a particular device Control extensibility Control extensibility  Ability to create new mobile controls, user controls, inheritance controls, composite controls, and direct control

47 Web Form And Mobile Web Form Mobile Web Form Hello, Mobile World Hello, World </Form>

48 Adaptive Control Model PhoneCall example WML cHTML HTML PhoneCall Mobile Capabilities Return HTML with alternative text Mobile.ASPX Get Device Adapter Get Browser & Device Select Device Adapter Get Device Adapter Page instantiates control Return WML with the WTAI tag

49 Mobile Controls

50 Reasons To Customize Optimize the generated rendering Optimize the generated rendering  Per device or class of device  Used on a per application basis Control the exact display Control the exact display Ability to override default behavior Ability to override default behavior

51 ObjectList Control Header Template Item Template AlternateItem Template Footer Template Separator Template Pocket PC Customization ItemDetails Template

52 ObjectList Template

53 Mobile Controls Summary

54 Devices VS Whidbey (C#, VB.NET, C++) eVC 3 (C++) eVC 4 (C++) VS.NET 2003 (VB.NET) eVC 3 (C++) eVB 3 (VB) eVC 3 (C++) eVB 3 (VB) Tools PPC +PE 2003 SP 2003 PPC + PE 2002 SP 2002 PPC 2000 Platforms +.NET CF Whidbey, New native runtimes and Full managed code, (Notification Manager, DirectX, Location APIs, Dr Watson) +.NET Compact Framework, Bluetooth, SMS + MFC, Connection Manager Win32,POOM APIs Macallan4.23.0 CE OS Windows Mobile Roadmap PPC = Pocket PC PPC PE = Pocket PC Phone Edition SP = Smartphone SP v Next (QVGA,Standard) PPC + PE v Next (VGA, Landscape, Square, Standard)

55 Futures From the PDC In the OS In the OS  eDB – a step forward from CEDB  Location Services API  Update to WebServer (ASP support)  Pocket Watson  DirectX (D3D, modular Media Player) For the developer For the developer  Combined IDE for Native and Managed  Mobile SOAP toolkit.NET CF V2 development.NET CF V2 development  COM interop, XPath, Crypto, Registry, Generics etc.  Hosting Interface  New Libraries  System.Messaging  Unified Notifications  POOM – SMS, Mail, Calendar, Tasks etc.  Telephony, all Phone related functions

56 Hardware Futures Displays Displays  Pocket PC Portrait/Landscape support  Pocket PC Square Screen  Pocket PC VGA  Smartphone QVGA Form Factors Form Factors  Hybrid devices  Pocket PC softkey support Multiple-Radios Multiple-Radios  GSM/GPRS CDMA/1xRTT  WiFi (802.1x)  Bluetooth  Location Services

57 SQL CE Futures Laguna code name for SQL CE 3.0 Laguna code name for SQL CE 3.0 Runtime Improvements: Runtime Improvements:  Performance – remove OLEDB for managed code  Re-use spent storage pages  Query hints  Updateable scrollable cursors.  Multi User Tools: Tools:  Integration to Workbench  DTS  Data Designer in Whidbey

58 Summary Windows Mobile 2003 offers a rich and robust platform on which to build and deploy Mobile applications. Windows Mobile 2003 offers a rich and robust platform on which to build and deploy Mobile applications. Microsoft Visual Studio.NET 2003 provides state of the art development tools for targeting the Compact Framework. Microsoft Visual Studio.NET 2003 provides state of the art development tools for targeting the Compact Framework. The Compact Framework brings Mobile devices to the mainstream development community. The Compact Framework brings Mobile devices to the mainstream development community.

59 © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Windows Mobile Developer Marcus Perryman Morgan Skinner."

Similar presentations


Ads by Google