Download presentation
Presentation is loading. Please wait.
1
.Net 3.0 and Windows Presentation Foundation
Jim Fawcett CSE775 – Distributed Objects Spring 2007
2
References Introducing Windows Presentation Foundation, David Chappell, Several figures used from this presentation Introducing Windows Communication Foundation, David Chappell, Foundations of Windows Presentation Foundation, Laurence Moroney, Apress, 2006 Scalable Vector Graphics (SVG), XML Graphics for the Web,
3
References Introduction to Vector Markup Language (VML), Windows Presentation Foundation, Ronnie Saurenmann, Windows Presentation Foundation, Sue Chard,
4
.Net 3.0 The .Net 3.0 Framework has support for three major pieces, available for Vista, XP, and Server 2003: Windows Work Flow (WF) Windows Communication Foundation (WCF) Windows Presentation Foundation (WPF) There is a fourth piece, Media Foundation, available only on Vista A COM multi-media framework, designed to replace DirectShow, Windows Media SDK, DirectX media, etc. Won’t be available on XP. Basic tools (command line compilers etc) and Framework classes support these. New, more productive, tools are coming with the Orcas release of Visual Studio, later this year.
5
Windows Work Flow (WF) Windows Work Flow is:
An execution engine for code-based activities Essentially an attempt at simplifying organization of programs. Executes activity blocks and sequences between blocks based on connectivity and control constructs, or based on events. Runs in two modes: Sequential is essentially a flow-chart execution engine State is a state-machine execution engine Discussion I’ve read indicates that it is oriented primarily toward implementing “Business Rules”. Workflows are programmed in XAML (used to be called XOML in WF. The O stood for Object.
6
All diagrams from Chappell, IWPF
7
Windows Communication Foundation
Convergence of application programming models for communication, supporting: Web Services (Asp Web Services) Web Applications (Asp.Net) Windows Services (NT Services) Remoting (.Net Remoting) Queuing (MSMQ) Can be hosted in: IIS Windows Services Windows Applications
8
WCF Services Chappell (IWCF)
9
Windows Presentation Foundation
Convergence of presentation programming models, Supporting: Desktop applications WinForms, MFC, WTL, Win32 Web applications Asp.Net Document presentation Word Documents
10
Chappell (IWPF)
11
Chappell (IWPF)
12
Elements of WPF Scalable Vector Graphics
It is not clear whether WPF is based on standard SVG or on Microsoft’s proprietary Vector Markup Language (VML) eXtensible Application Markup Lanaguage (XAML) A dilect of XML with tags defined for specific graphics (or other application) operations: <Rectangle Width="30" Height="10" Fill="HorizontalGradient Red Yellow" /> CodeBehind Event handler code
13
Adapted from Chard (WPF)
Applications Controls Styling Layout Data Content Action Presentation Framework Adapted from Chard (WPF) PresentationCore.dll - managed MilCore.dll – unmanaged composition DirectX – a COM technology Driver
14
Features Programming Interop with Forms
Declarative programming with XAML Imperative programming with classes from System.Windows namespace Interop with Forms Host Forms controls on WPF pages Host WPF controls on Forms
15
WPF Support for Presentation
Presentation mode: Window: basic display windows NavigationWindow: hyperlinked navigation Layout: DockPanel: Flow layout like a web page StackPanel: Linear layout, ala toolbars Grid: Absolute positioning on grid Canvas: Free positioned layout Controls: All the usual plus new addtions Supports custom controls
16
Styles Cascading Style Sheets Style element class: Inline styles:
It is not clear that WPF directly supports CSS WPF does have DataTemplate and ControlTemplate classes that support styling data layouts and controls. Style element class: <style>…</style> Inline styles: <Button style=“{StaticResource ButtonStyle}”>a title</Button>
17
Documents Typography: Documents OpenType fonts ClearType Glyphs
FixedDocument class Layout is fixed for rendering in any window or printer, does not flow FlowDocument class Uses browser flow model Lots of control over the details of how that is done through properties
18
Media Images Video <Image width=“200” Source=“C:\temp\us.jpg” />
Can have metadata Can be painted onto 3D canvases Video <MediaElement Source=“c:\temp\myVid.wmv” /> Handles wmv, mpeg, avi, wav, …
19
Audio & Video Formats: WMV, MPEG, Some AVIs
Ronnie Saurenmann (WPF) <Border Width="400" BorderBrush="Green" BorderThickness="9"> <StackPanel> <MediaElement Source="aero.wmv" /> <Button>Hello</Button> </StackPanel> </Border> WPF supports the following audio/video formats. Windows Media Video (.wmv) files are Advanced Systems Format (.asf) files that include audio, video, or both compressed with Windows Media Audio (WMA) and Windows Media Video (WMV) codecs. MPEG (pronounced M-peg), which stands for Moving Picture Experts Group, is the name of family of standards used for coding audio-visual information (e.g., movies, video, music) in a digital compressed format. The major advantage of MPEG compared to other video and audio coding formats is that MPEG files are much smaller for the same quality. This is because MPEG uses very sophisticated compression techniques. AVI, an acronym for Audio Video Interleave, is a multimedia container format introduced by Microsoft in November 1992, as part of the Video for Windows technology. AVI files contain both audio and video data in a standard container that allows simultaneous playback. Formats: WMV, MPEG, Some AVIs Can be synchronized with animations Windows Media Foundation used to instantiate playback machinery into a DirectShow graph 19
20
2D Graphics Support for primitives:
Line, Ellipse, Rectangle, Polygon, Polyline, Path Support for defining regions: LineGeometry, RectangleGeometry, …
21
2D Graphics, 3D Graphics, Imaging
Ronnie Saurenmann (WPF) 2D Graphics 3D Graphics Imaging Let’s look at the WPF support for 2D and 3D graphics, and imaging. Graphics - The following areas comprise the Windows Presentation Foundation graphic APIs. Brushes. Use the Brush classes to paint areas with solid colors, patterns, images, and drawings. Shapes. Use Shape classes to create and render 2-D geometric shapes. Imaging. Use the imaging classes to encode, manipulate, and displays bitmaps, and to apply special effects such as glow and blur to images and vectors. Geometries. Geometries, like shape objects, represent 2-D shapes. Geometries are more versatile than shape objects, in that they can be used to define curves, clipping regions, and hit-testing areas. Unlike shape objects, geometries do not participate in the layout system and cannot draw themselves to the screen. They can be rendered using other framework elements, controls, visuals, or brushes. Transformations. Use the Transform classes to rotate, translate, scale, and apply other 2-D effects to geometries, visuals, brushes, framework elements, and controls. Animations. Use the animation and timing APIs to make objects change color, move, spin, grow, shrink, and more. Visuals. Visual objects are the building blocks of the Windows Presentation Foundation rendering system. The visual layer is the Windows Presentation Foundation equivalent to GDI. All Windows Presentation Foundation objects use visuals to draw to the screen. 3-D Graphics - The System.Windows.Media.Media3D namespace defines 3-D graphics primitives, transformations, and animations that can be used to create 3-D controls and graphics. Imaging Platform Basics Not the mainstream WPF usage, but critical for a class of customers Industrial strength, used extensively in the Windows Vista Shell 3rd party extensible bitmap CODEC architecture Microsoft-supplied CODECs for JPEG, TIFF, PNG, GIF, BMP, ICO Streams and NT Sections Thumbnails in the Windows Vista shell “Mainline” encode / decode, explicit imaging operations, etc. Access through managed and native code Imaging engine in Windows Vista, can be used by Win32 21
22
3D Graphics Viewport3D control Models Define shape, lighting, viewing
GeometryModel3D class SpecularMaterial class DiffuseMaterial class DirectionalLight AmbientLight PerspectiveCamera OrthographicCamera
23
Transformations RotateTransform ScaleTransform RenderTransform
Blur and glow effects
24
Animations Storyboard class
Defines element(s) to which animation applies, by name Initial properties like size and position Range of changes of those properties with duration settings (time between changes)
25
Combining Stuff Most of the WPF elements can be containers:
Can put an ellipse in a button Graphics figures, controls, animations, … can be freely mixed and applied to each other.
26
Applications Desktop applications XAML Browser Applications (XBAPS)
Full trust Rich, but familiar applications XAML Browser Applications (XBAPS) Lowered trust Many operations are not allowed, e.g., access to local file system May appear very like an equivalent desktop application Most of the code is the same
27
End of Presenation
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.