how microsoft visual studio 2010 was built with wpf 4

36
How Microsoft Visual Studio 2010 Was Built with WPF 4 Paul Harrington Principal Software Engineer Microsoft Corporation CL09

Upload: marcel

Post on 22-Feb-2016

55 views

Category:

Documents


0 download

DESCRIPTION

CL09. How Microsoft Visual Studio 2010 Was Built with WPF 4. Paul Harrington Principal Software Engineer Microsoft Corporation. Why, What, How, Who?. Why WPF? What WPF features are used? How was it built? Who was involved?. Why WPF?. Technological Prove the capabilities of WPF 4.0. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: How Microsoft Visual Studio 2010 Was Built with WPF 4

How Microsoft Visual Studio 2010 Was Built with WPF 4

Paul HarringtonPrincipal Software EngineerMicrosoft Corporation

CL09

Page 2: How Microsoft Visual Studio 2010 Was Built with WPF 4
Page 3: How Microsoft Visual Studio 2010 Was Built with WPF 4
Page 4: How Microsoft Visual Studio 2010 Was Built with WPF 4

Why, What, How, Who?> Why WPF?> What WPF features are used?> How was it built?> Who was involved?

Page 5: How Microsoft Visual Studio 2010 Was Built with WPF 4

Why WPF?> Technological

> Prove the capabilities of WPF 4.0

Page 6: How Microsoft Visual Studio 2010 Was Built with WPF 4

The Visual Studio 2010 IDE

Paul HarringtonPrincipal Software EngineerVisual Studio Platform Team

demo

Page 7: How Microsoft Visual Studio 2010 Was Built with WPF 4

Why WPF?

> Architectural> Separated Presentation> Support for long range road map

> Key VS 2010 features need it> Editor, Architecture editor, Parallel tools…

> We took the “pain” so you don’t have to

> Technological> Prove the capabilities of WPF 4.0

Page 8: How Microsoft Visual Studio 2010 Was Built with WPF 4

What WPF Features are used?> Declarative UI using XAML> Data binding

> Managed and native data models> Style templates> Application Resources> Interop with Win32> Integration with the message loop> New text stack based on DirectWrite

Page 9: How Microsoft Visual Studio 2010 Was Built with WPF 4

Staged Approach> Define the data models> Replace the main window with WPF> Write new

> Window Manager, Command Bar presentation

> Hidden behind switches, off by default> Scout with selected teams> Test, test, test> Reverse the switches

> Leave old presentation for regression testing

> Remove old code

Page 10: How Microsoft Visual Studio 2010 Was Built with WPF 4

A lesson learned: Test conversion costs> We underestimated the cost of

rewriting test cases> Too many HWND assumptions> Many different testing frameworks

> But there were opportunities> Unify test frameworks> UI Automation accessibility framework> Test at the data layer

Page 11: How Microsoft Visual Studio 2010 Was Built with WPF 4

What were the challenges?> Mixed mode application

> Native and Managed code> WPF and HWNDs (Win32 and WinForms)

> Keep existing extensions working> Allow new extensions to take advantage

of WPF> Don’t “stop the train”> Text Clarity> Performance

Page 12: How Microsoft Visual Studio 2010 Was Built with WPF 4

Challenges of a Mixed-Mode App> Interop in the data layer

> Managed code binding to native models> Interop in the presentation layer

> Composition of new and old> Focus and activation> Integration with the message loop

Page 13: How Microsoft Visual Studio 2010 Was Built with WPF 4

Composition of new and oldinterface IVsWindowPane : IUnknown{ HRESULT SetSite ([in] IServiceProvider *pSP); HRESULT CreatePaneWindow([in] HWND hwndParent, [in] int x, [in] int y, [in] int cx, [in] int cy, [out] HWND *hwnd); HRESULT GetDefaultSize([out] SIZE *psize); HRESULT ClosePane(void); HRESULT LoadViewState([in] IStream *pstream); HRESULT SaveViewState([in] IStream *pstream); HRESULT TranslateAccelerator(LPMSG lpmsg);}

Page 14: How Microsoft Visual Studio 2010 Was Built with WPF 4

Presentation-neutral interfacesinterface IVsUIElementPane : IUnknown{ HRESULT SetUIElementSite([in] IServiceProvider *pSP); HRESULT CreatePane([out] IUnknown **ppunkUIElement);

HRESULT GetDefaultUIElementSize([out] SIZE *psize); HRESULT CloseUIElementPane(void); HRESULT LoadUIElementState([in] IStream *pstream); HRESULT SaveUIElementState([in] IStream *pstream); HRESULT TranslateUIElementAccelerator(MSG *lpmsg);}

Page 15: How Microsoft Visual Studio 2010 Was Built with WPF 4

Integrating with the Message Loop and Focus Handling

Paul HarringtonPrincipal Software EngineerVisual Studio Platform Team

demo

Page 16: How Microsoft Visual Studio 2010 Was Built with WPF 4

Integrating with the Message Loop> ComponentDispatcher

> RaiseThreadMessage method> Managing Focus

> HwndSource.DefaultAcquireHwndFocusInMenuMode

> Use WindowsFormsHost> Menu mode

> InputManager.Push/PopMenuMode methods

> Listen to PreviewGotKeyboardFocus

Page 17: How Microsoft Visual Studio 2010 Was Built with WPF 4

Text and Image Clarity> “Fuzzy” images

> UseLayoutRounding = "True"> “Blurry” text

> TextFormattingMode = "Display"

Page 18: How Microsoft Visual Studio 2010 Was Built with WPF 4

DirectWrite

Paul HarringtonPrincipal Software EngineerVisual Studio Platform Team

demo

Page 19: How Microsoft Visual Studio 2010 Was Built with WPF 4

Performance> Startup> Atomic operations on the Visual Tree> Memory usage

> VMMap> SOS.dll, !dumpheap –stat

> Windows Performance Analyzer (xperf)

> Hardware versus Software rendering> Virtual machines and Remote Desktop

> Scrolling in the Editor

Page 20: How Microsoft Visual Studio 2010 Was Built with WPF 4

Scrolling Performance> Visual.VisualScrollableAreaClip

> Hint to software renderer to use scrolling> Best with

> UseLayoutRounding="True"

Page 21: How Microsoft Visual Studio 2010 Was Built with WPF 4

Who?> Core team of about 12 people

> 7 developers> 5 testers

> WPF Team> Expression Suite Team

Page 22: How Microsoft Visual Studio 2010 Was Built with WPF 4

WPF Sessions @ PDC09> PDC09-CL09 How Microsoft Visual Studio 2010 Was Built with Windows

Presentation Foundation 4 TUE 11/17/2009, 11:00AM - 12:00PM, Room 502A

> PDC09-CL11 Advanced Windows Presentation Foundation Application Performance Tuning and Analysis TUE 11/17/2009, 4:30PM - 5:30PM, Room Petree Hall D)

> CHALK TALK Deep Dive into WPF4 Multi-Touch APIs WED 11/18/2009 11:00PM - 12:00PM, The Big Room

> PDC09-CL31 Mastering WPF Graphics and Beyond WED 11/18/2009, 12:30-1:15PM, Room Hall E - 151

> PDC09-CL10 Windows Presentation Foundation 4 Plumbing and Internals THUR 11/19/2009, 10:00AM - 11:00AM, Room Hall E – 151

> PDC09-CL27 Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers THUR 11/19/2009 , 11:30AM - 12:30PM, Room Petree Hall C

> PDC09-CL24 XAML Futures in Microsoft .NET Framework, Microsoft Silverlight and Tools, THUR 11/19/2009 , 1:45PM - 2:45PM, Room Hall F - 153

> MORE WPF 4 @ WPF Community site http://connect.microsoft.com/wpf

Page 23: How Microsoft Visual Studio 2010 Was Built with WPF 4

Resources> Snoop http://www.blois.us/Snoop/> Microsoft Windows SDK for Windows 7

and .NET Framework 3.5 SP1> After download, run “Install Windows

Performance Toolkit”. Installs:> Windows Performance Analyzer (XPerf) > WPF Performance Suite (VisualProfiler,

Perforator)> VMMap.exe live.sysinternals.com> XamlPad is in the Windows 6.0A SDK

> Use a XamlPad.exe.config to run on WPF 4.0

Page 24: How Microsoft Visual Studio 2010 Was Built with WPF 4

Q&A

Page 25: How Microsoft Visual Studio 2010 Was Built with WPF 4

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation

forms online atMicrosoftPDC.com

Page 26: How Microsoft Visual Studio 2010 Was Built with WPF 4

Learn More On Channel 9> Expand your PDC experience through

Channel 9

> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learnBuilt by Developers for Developers….

Page 27: How Microsoft Visual Studio 2010 Was Built with WPF 4

© 2009 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.

Page 28: How Microsoft Visual Studio 2010 Was Built with WPF 4

Appendix

Page 29: How Microsoft Visual Studio 2010 Was Built with WPF 4

DirectWrite formatting and rendering modesTextOptions.TextFormattingMode ="Ideal""Display"

TextOptions.TextRenderingMode ="Auto""Aliased""Grayscale""ClearType"

Page 30: How Microsoft Visual Studio 2010 Was Built with WPF 4

TextFormattingMode “Ideal”

Page 31: How Microsoft Visual Studio 2010 Was Built with WPF 4

TextFormattingMode “Display”

Page 32: How Microsoft Visual Studio 2010 Was Built with WPF 4

TextFormattingMode comparison

Page 33: How Microsoft Visual Studio 2010 Was Built with WPF 4

DirectWrite> Ideal

> Display

Page 34: How Microsoft Visual Studio 2010 Was Built with WPF 4

Ideal

Display

Page 35: How Microsoft Visual Studio 2010 Was Built with WPF 4

Running XamlPad on WPF 4.0

Create a file called XamlPad.exe.config with the following contents. Save it alongside XamlPad.exe.

<?xml version ="1.0"?><configuration>  <startup>    <requiredRuntime version="v4.0" />  </startup></configuration>

Page 36: How Microsoft Visual Studio 2010 Was Built with WPF 4