Download presentation
Presentation is loading. Please wait.
Published byNorman Wilkins Modified over 9 years ago
1
1 Windows Presentation Foundation ("Avalon"): Using Application Services Lauren Lavoie PRS314 Program Manager Microsoft Corporation llavoie@microsoft.comhttp://laurenlavoie.com/avalon
2
2 Outline Creating a smart client application Demo: Chefalon Smart client app challenges Demo: Runtime management and resources Demo: Storage and user experience model Creating a rich browser application Web application challenges Web Browser Applications Demo: Moving Chefalon into the browser Q&A
3
3 Chefalon
4
4 Application Model Challenges App frameworks are restrictive Infrastructure for user experience models doesn’t exist Platforms don’t provide good metaphors for app-level management
5
5 App State and Runtime Management is the base class for an app is the base class for an app Starts and stops the application Resources A place for your app-global state Property bag Subclassing Events rather than WM_* messages Activation, deactivation App exit, session ending Window management
6
6 Application Resources Declarative model for loading resources <Frame Source= “pack://siteoforigin:,,Quiche.xaml” /> <Frame Source= “Food;Component/Egg.xaml” /> “Food;Component/Egg.xaml” /> Resources in the app Loose files in app dir From site of origin In another assembly Navigate(new Uri(“Mushroom.xaml”, UriKind.RelativeOrAbsolute)); Navigate(new Uri(“Salmon.xaml”, UriKind.RelativeOrAbsolute)); Navigate(new Uri( “pack://siteoforigin:,,Quiche.xaml”, UriKind.RelativeOrAbsolute)); Navigate(new Uri(“Food;Component/Egg.xaml”, UriKind.RelativeOrAbsolute));
7
7 Chefalon: Basic Application Framework
8
8 Persistent Storage and Settings Application Cookies Isolated Storage File System Windows Registry.config
9
9 User Experience Model Flavors of Windows Applications MDI SDI / Dialog Navigation- based SDI Structured Navigation Navigation- based MDI
10
10 User Experience Model Dialog-Based SDI Use Windows, Dialogs, and Controls May manage multiple windows in the same app Features often surfaced to users through menus Great UX paradigm for simple or frequent tasks The user is in control // Window1.xaml </Window>
11
11 User Experience Model Basic Navigation Great UX paradigm for tasks that are unfamiliar to users or involve several steps User may be led through steps or can safely explore Use Pages, Hyperlinks, Frames NavigationWindow created implicitly when StartupUri is set Navigation UI and history provided out of the box // Page1.xaml Go To Page 2 Go To Page 2 </Page> // Page2.xaml This is Page 2 This is Page 2 </Page>
12
12 Chefalon: Adding Navigation Functionality
13
13 Problems with Simple Navigation Hyperlink == GOTO http://www.site.com/login.aspx?param1=hello&b ack=homepage.aspx
14
14 Structured Navigation Solving the Problems with Simple Navigation PageFunctions == function calls
15
15 User Experience Model Structured Navigation Great UX paradigm for tasks involving a sophisticated flow of steps The app drives the user Use PageFunction PageFunction is called like a function, returns result to caller Upon finish, returns the user to the calling page May create sophisticated topologies // PF1.xaml...... // Page1.xaml.cs PF1 pf = new PageFunction1(); pf.InitializeComponent(); pf.Return += new ReturnEventHandler (pf_Return); this.NavigationService.Navigate(pf);
16
16 Chefalon: Adding Structured Navigation
17
17 Web Application Challenges Vastly different programming models for Web and Windows apps Making highly interactive, personalized Web apps is hard Creating interactive apps often requires a tradeoff with security
18
18 Web Browser Applications (WBA) Moving WPF to the Web Run in a security sandbox Have no security or installation prompt Are not installed No Start Menu or Add/Remove Programs presence Use ClickOnce for deployment Run in the browser Familiarity of web browsing Are “online only” apps
19
19 Web Browser Applications The Security Sandbox Web Browser Apps run in a sandbox Full Trust (Standalone Apps) Secondary Windows, File System Access, WCF, Registry Access… Internet Zone (WBA) Isolated Storage, Site of Origin Access, Printing, 3D, Flow, Animation… Code Access Security (CAS) Permission-based sandbox Applications are limited by deployment zone App is granted specific set of permissions Attempt to use features not enabled in sandbox raises SecurityException
20
20 Web Browser Applications The defense-in-depth foundation Code Access Security – 1 st line of defense Security Transparent / Security Critical IE7 Protected Mode on Windows Vista On other platforms, remove IE6’s admin token Out of process from browser Hard isolation boundary Trustworthy Computing best practices Threat models, code reviews, static tools
21
21 Web Browser Applications Converting a desktop app to a web app Specify “Web Browser Application” Using the Visual Studio 2005 template By setting 3 properties in your project file Remove non-sandbox friendly code Conditional blocks Runtime checks // Get AppDomain’s permission set PermissionSet aDPermSet = AppDomain.CurrentDomain.DefaultGrantS et.ApplicationTrust.PermissionSet; PermissionSet permSet = new PermissionSet(); permSet.AddPermission(new UIPermission(UIPermissionWindow.AllWi ndows); // Set cache bit _bindToWindow = !permSet.IsSubsetOf(aDPermSet); #if (WBA) // Write to iso storage // Write to iso storage#else // Write to file system // Write to file system#endif
22
22 Chefalon: Moving into the Browser
23
23 Practical Web Browser Applications Migrating or integrating with your existing site Multiple renderings – WPF for the premium experience Sniffing the UserAgent string Leveraging your existing content Hosting HTML in WPF Hosting WPF in HTML Interop with an existing backend Using cookies Use XSLT to transform to loose XAML
24
24 Web Browser Apps and Installed Apps Two great flavors of WPF hosting Web Browser Apps Safe and easy for users Seamless browser experience – no prompts! Power of the platform on the Web Installed Apps Can use non-sandbox features Can create immersive experiences Can provide offline support “Sticky” desktop presence
25
25 Summary WPF provides options for app management Low policy primitives for system and data management Built-in infrastructure for common user experience models Web Browser Applications give you the power of WPF on the Web Runs in a security sandbox Seamless browser experience
26
26 Community Resources At PDC For more information, go see PRS330: Creating Rich Content Experiences in Your Applications FUN222: Installation Technologies for Windows Vista Labs: PRSHOL09, PRSHOL10 Ask The Experts Track lounge: I’ll be there Thu 9:30-12:30 After PDC If you missed this related session, watch on the DVD PRS313: Integrating with Your Win32/MFC Application http://laurenlavoie.com/avalon MSDN dev center: http://msdn.microsoft.com/smartclient/ http://msdn.microsoft.com/smartclient/ Channel 9 tag: http://channel9.msdn.com/tags/Avalon
27
27 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.