how microsoft visual studio 2010 was built with wpf 4
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 PresentationTRANSCRIPT
How Microsoft Visual Studio 2010 Was Built with WPF 4
Paul HarringtonPrincipal Software EngineerMicrosoft Corporation
CL09
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
The Visual Studio 2010 IDE
Paul HarringtonPrincipal Software EngineerVisual Studio Platform Team
demo
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
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
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
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
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
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
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);}
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);}
Integrating with the Message Loop and Focus Handling
Paul HarringtonPrincipal Software EngineerVisual Studio Platform Team
demo
Integrating with the Message Loop> ComponentDispatcher
> RaiseThreadMessage method> Managing Focus
> HwndSource.DefaultAcquireHwndFocusInMenuMode
> Use WindowsFormsHost> Menu mode
> InputManager.Push/PopMenuMode methods
> Listen to PreviewGotKeyboardFocus
Text and Image Clarity> “Fuzzy” images
> UseLayoutRounding = "True"> “Blurry” text
> TextFormattingMode = "Display"
DirectWrite
Paul HarringtonPrincipal Software EngineerVisual Studio Platform Team
demo
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
Scrolling Performance> Visual.VisualScrollableAreaClip
> Hint to software renderer to use scrolling> Best with
> UseLayoutRounding="True"
Who?> Core team of about 12 people
> 7 developers> 5 testers
> WPF Team> Expression Suite Team
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
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
Q&A
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation
forms online atMicrosoftPDC.com
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….
© 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.
Appendix
DirectWrite formatting and rendering modesTextOptions.TextFormattingMode ="Ideal""Display"
TextOptions.TextRenderingMode ="Auto""Aliased""Grayscale""ClearType"
TextFormattingMode “Ideal”
TextFormattingMode “Display”
TextFormattingMode comparison
DirectWrite> Ideal
> Display
Ideal
Display
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>