340 likes | 566 Views
Required Slide. SESSION CODE: WEM303. Gamechanger ! Using Microsoft Silverlight for Windows Embedded to Create an Amazing Embedded UI. Douglas Boling President Boling Consulting Inc. About Douglas Boling.
E N D
Required Slide SESSION CODE: WEM303 Gamechanger!Using Microsoft Silverlight for Windows Embedded to Create an Amazing Embedded UI Douglas Boling President Boling Consulting Inc.
About Douglas Boling • Independent consultant specializing in Windows Mobile and Windows Embedded Compact (Windows CE) • On-Site Instruction • Consulting and Development • Author • Programming Embedded Windows CE • Fourth Edition
Agenda • Basic Silverlight for Embedded • Fielding Events • Creating Storyboards • Bringing it together
Disclaimer… • I’m not a designer! • I’m a geek. • This geek is artistically challenged • Don’t expect too much
User Interface Evolution • In the beginning… • There was the command line • Perhaps a 10 key keyboard with LED display • GUI Operating Systems • Windows/Mac/Linux w/ a front end • Browser-based U/I • It’s like the Internet, it must be great!
Next Wave of U/I • Microsoft Silverlight • “Web-like” descriptive U/I language • XML Machine and human (mostly) readable • Real code backing for functionality • Cross platform compatibility • Separates Designers from Developers
Designers vs. Developers • Designers are great at UI • Also great at designing a UI that’s impossible to build! • Developers Spend countless hours implementing a design • When they should be implementing business logic
Silverlight • Original impression: Powerful platform for delivering web-based content • Actually, a powerful platform for developing platform independent applications • Combines the powerful U/I constructs of WPF with the light weight of a much smaller .NET runtime • Still, it’s .NET-based runtime not perfect for embedded systems…
Silverlight for Embedded • XAML-based interface description • Same as standard Silverlight 3 for Windows Embedded Compact • Silverlight 2 for Windows CE 6 Release 3 • Backed by native C++ code • High performance • Hardware access • Full Win32 API access • No ‘garbage collect pause’ • Support for Hardware-based graphics acceleration
Silverlight vs. Silverlight for Embedded Silverlight Silverlight For Embedded XAML based U/I Native code behind C++ Win32 API Runs natively on OS Tools Expression Blend Visual Studio • XAML based U/I • Managed code behind • C# • BCL framework • Runs in browser • Tools • Expression Blend • Visual Studio
Silverlight For Embedded Versions • Windows Embedded CE 6 Release 3 • Supports • Silverlight 2 • Manual porting of XAML to C++ application • Windows Embedded Compact 7 • Supports • Silverlight 3 • Automated porting of XAML to C++ application
Tools in Windows Embedded Compact 7 • Expression Blend 3 XMAL • Select Silverlight 3 application • Silverlight for Embedded SDK • Provides a project template for Silverlight for Embedded • Platform Builder 7 • Contains Migration tool for converting Silverlight project to native C++ project
Basic Development Process • Create a project with Expression Blend 3 • Create basic U/I • Name any elements you wish to access • Add any event handlers • In PB, use Tools | Windows Embedded Silverlight Tools… • Create Platform Builder Project • Add created project as subproject using “Add Existing…” menu item • Add C++ code behind • Launch application and debug…
Initial XAML <UserControl> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WindowsEmbeddedSilverlightApplication1.MainPage" Width="640" Height="480"> <Gridx:Name="LayoutRoot" Background="White"/> </UserControl>
Native Code Framework • PB tool creates a basic framework • App.cpp Startup/Exit callbacks, Framework init • App.h Implementation of basic app functionality • MainPage.cpp PageLoad event, Where event callbacks are placed • MainPage.h Support for MainPage.cpp • Other .cpp and .h files as needed for additional forms
Initial MainPage.cpp #include"stdafx.h" #include"TechEd1Generated.h" #include"MainPage.h" #include"App.h" #include"resource.h" // ============================================================================ // OnLoaded // // Description: Calls InitializeComponent to bind member variables to named // elements, and attach event handlers specified in XAML // // Parameters: pRoot - The root dependency object. // ============================================================================ HRESULT MainPage::OnLoaded(__in IXRDependencyObject* pRoot) { UNREFERENCED_PARAMETER(pRoot); HRESULT hr = InitializeComponent(); // Add calls to FindName or Add___EventHandler() methods after this comment. returnhr; } // OnLoaded
Fielding Events • Add controls in XAML that generate events • Add x:Name attribute to identify • Add dummy event handler in Expression • Run PB Silverlight Migration tool to update native project • Update native project to act on event
Fielding Events XAML and Code <UserControl> … <Gridx:Name="LayoutRoot" Background="White"> <Buttonx:Name="MyButton" Content="Click Me!" Margin="250 200" Click="MyButton_Click"/> </Grid> </UserControl> // ============================================================================ // MyButton_Click // ============================================================================ HRESULT MainPage::MyButton_Click (IXRDependencyObject* pSender, XRMouseButtonEventArgs* pArgs) { HRESULT hr = E_NOTIMPL; if ((NULL == pSender) || (NULL == pArgs)) { hr = E_INVALIDARG; } return hr; }
Demo: Adding Events DEMO
Creating Storyboards • Storyboards are animations of object properties • Easily created with Expression Blend • Not so easy to do manually • Storyboards are objects • Find like other objects • Call Start() method to play
Playing A Storyboard <Storyboardx:Name="Storyboard1"> <DoubleAnimationUsingKeyFramesBeginTime="00:00:00" Storyboard.TargetName="btnLeft" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrameKeyTime="00:00:00.5000000" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> // // Play a storyboard // IXRStoryboard*pSB; FindName(TEXT("Storyboard1"),(IXRDependencyObject**)&pSB); if(pSB != NULL) { pSB->Stop(); pSB->Begin(); }
Bringing It Together • All the following techniques enable a great user interface • The key is that you can still use Win32 APIs directly • This makes Silverlight for Embedded a great tool for embedded applications
Summary • Silverlight for Embedded changes everything • U/I now done by designer without creating implementation pain for the developer • Powerful flexibility makes up for somewhat tedious hookup
Questions Douglas Boling www.bolingconsulting.com dboling @ bolingconsulting.com
Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • http://www.WindowsEmbedded.com • http://msdn.microsoft.com/en-us/windowsembedded • http://social.msdn.microsoft.com/Forums/en-US/category/embeddedwindows/ • http://social.msdn.microsoft.com/Forums/en-US/category/windowsembeddedcompact • https://connect.microsoft.com/windowsembeddedce
Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Related Content • Breakout Sessions • WEM201 | Discover Windows Embedded Standard 7 as Your Next Application Platform • WEM301 | Deploying Windows Embedded Standard 7 with Style • WEM302 | Explore the Multimedia Potential of Windows Embedded Standard 7 • WEM303 | Gamechanger: Using Microsoft Silverlight for Windows Embedded to Create an Amazing Embedded UI • WEM305 | How to Choose a Windows Embedded Operating System • WEM306 | Using the Sensor & Location API on Windows Embedded Standard 7 to Create Exciting Connected Applications • WEM307 | Windows Embedded Compact: New Tools and Developer Story • WEM308 | Windows Embedded Overview: Demos of the Latest and Upcoming Releases • WEM309 | Programming Microsoft Silverlight for Windows Embedded Using Microsoft .NET • Interactive Sessions • WEM01-INT | Build a Secure Device with Windows Embedded Standard 7 • WEM02-INT | Delivering Flexible Peripheral Support for Point of Sale • WEM03-INT | How Windows Embedded Solutions Help to Protect the Environment • WEM05-INT | What a Desktop Developer Needs to Know to Develop for Windows Embedded • WEM06-INT | Windows Embedded Compact Compete • WEM07-INT | Server Appliances with Windows Embedded Servers • WEM08-INT | Roundtable: Windows Embedded @ Tech·Ed 2011 - Tell Us What You Want to Learn
Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Related Content • Hands-on Labs • WEM01-HOL | Build Your Own Embedded System • WEM04-HOL | Porting Third-Party Drivers into Image Configuration Editor • Product Demo Stations (all on Windows Embedded booth) • TLC-46 | Get Your Hands on Windows Embedded • TLC-47 | Powered by Windows Embedded POSReady – Touch Screen • TLC-48 | The Intel® Intelligent Digital Signage Proof of Concept • TLC-49 | Windows Embedded Automotive • TLC-50 | Windows Embedded Device Showcase
Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn
Required Slide Complete an evaluation on CommNet and enter to win!
Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year
© 2010 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.