Paul Harrington Principal Software Engineer Microsoft 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 40 ID: 356887
Download Presentation The PPT/PDF document "How Microsoft Visual Studio 2010 Was Bui..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
How Microsoft Visual Studio 2010 Was Built with WPF 4
Paul HarringtonPrincipal Software EngineerMicrosoft Corporation
CL09Slide2Slide3Slide4
Why, What, How, Who?
Why WPF?What WPF features are used?
How was it built?
Who was involved?Slide5
Why WPF?
TechnologicalProve the capabilities of WPF 4.0Slide6
The Visual Studio 2010 IDE
Paul Harrington
Principal Software Engineer
Visual Studio Platform Team
demo Slide7
Why WPF?
ArchitecturalSeparated 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.0Slide8
What WPF Features are used?
Declarative UI using XAMLData binding
Managed and native data models
Style templates
Application Resources
Interop with Win32
Integration with the message loop
New text stack based on DirectWriteSlide9
Staged Approach
Define the data modelsReplace 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 codeSlide10
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 layerSlide11
What were the challenges?
Mixed mode applicationNative 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
PerformanceSlide12
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 loopSlide13
Composition of new and old
interface
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);}Slide14
Presentation-neutral interfaces
interface
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);}Slide15
Integrating with the Message Loop and Focus Handling
Paul Harrington
Principal Software Engineer
Visual Studio Platform Team
demo Slide16
Integrating with the Message Loop
ComponentDispatcher
RaiseThreadMessage
method
Managing Focus
HwndSource.DefaultAcquireHwndFocusInMenuMode
Use
WindowsFormsHost
Menu mode
InputManager.Push
/
PopMenuMode
methods
Listen to
PreviewGotKeyboardFocusSlide17
Text and Image Clarity
“Fuzzy” images
UseLayoutRounding
= "True"
“Blurry” text
TextFormattingMode
= "Display"Slide18
DirectWrite
Paul Harrington
Principal Software Engineer
Visual Studio Platform Team
demo Slide19
Performance
StartupAtomic 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 EditorSlide20
Scrolling Performance
Visual.VisualScrollableAreaClip
Hint to software renderer to use scrolling
Best with
UseLayoutRounding
="True"Slide21
Who?
Core team of about 12 people7 developers
5 testers
WPF Team
Expression Suite TeamSlide22
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 RoomPDC09-CL31 Mastering WPF Graphics and Beyond WED 11/18/2009, 12:30-1:15PM, Room Hall E - 151PDC09-CL10 Windows Presentation Foundation 4 Plumbing and Internals THUR 11/19/2009, 10:00AM - 11:00AM, Room Hall E – 151PDC09-CL27 Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers THUR 11/19/2009 , 11:30AM - 12:30PM, Room Petree Hall CPDC09-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 Slide23
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.0Slide24
Q&ASlide25
YOUR FEEDBACK IS IMPORTANT TO US!
Please fill out session evaluation forms online at
MicrosoftPDC.comSlide26
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/learn
Built by Developers for Developers….Slide27Slide28
AppendixSlide29
DirectWrite
formatting and rendering modes
TextOptions.TextFormattingMode
=
"Ideal"
"Display"
TextOptions.TextRenderingMode
=
"Auto"
"Aliased"
"Grayscale"
"
ClearType
"Slide30
TextFormattingMode “Ideal”Slide31
TextFormattingMode
“Display”Slide32
TextFormattingMode comparisonSlide33
DirectWrite
Ideal
DisplaySlide34
Ideal
DisplaySlide35
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
>Slide36