MSDNEvent-WPF-Vista-SP1

advertisement
MSDN Events
Summer 2008
Lindsay Rutter
Developer Evangelist
Microsoft Corporation
My Blog:
http://blogs.msdn.com/lindsay
WPF Demystified
Top 10 Security Reasons for Deploying to Vista
What’s new in .NET 3.5 SP1 & Visual Studio 2008 SP1
http://www.peterlaudati.com
Silverlight 2.0 Firestarter
September 13th, 2008 @ Microsoft NYC Offices
http://blogs.msdn.com/peterlau
VSLive! New York 2008
September 7th – 10th, 2008
http://vslive.com
Speakers include: Dani Diaz, G. Andrew Duthie,
Rocky Lhotka, Fritz Onion, Bill Wolff, Mary Jo Foley
Area User Groups
•NYC .NET Developers UG (MS NYC Office) – 3rd Thursdays
•http://www.nycdotnetdev.com
•LI .NET UG (Melville, NY) – 1st Thursdays
•http://www.lidotnetusersgroup.com
•Northern NJ .NET UG (Parsippany, NJ) – 2nd Tuesdays
•http://www.n3ug.org
•NJ MS Developers Group (Iselin, NJ) – 1st Thursdays
•http://www.njmsdev.org
•Central Jersey .NET UG (East Windsor, NJ) – 2nd Thursdays
•http://www.njdotnet.net
•Fairfield/Westchester .NET UG (Stamford, CT) – 1st Tuesdays
•http://fairfieldwestchester.net
•Fairfield/Westchester SQL UG (Stamford, CT) – 2nd Wednesdays
•http://fwsql.net
•NJ SQL User Group (Parsippany, NJ) – 3rd Tuesdays
•http://njsql.org
WPF Demystified
What is WPF & XAML
Essential concepts of Windows
Presentation Foundation
How to create a data-bound,
service based WPF application
User Interface development
.NET language
VB
C#
Familiar with XML
Visual Studio 2008
Level 100
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
LAYOUT
Microsoft Confidential
SPECS
COMP
HTML / CSS
PRODUCTION
Microsoft Confidential
FINAL RESULT
Microsoft Confidential
DESIGNER
XAML
Microsoft Confidential
DEVELOPER
XAML
XAML = eXtensible Application Markup
Language
Flexible XML document schema
Examples: WPF, Silverlight, Workflow Foundation
More compact than code
Enables rich tooling support
While still preserving good readability and handcoding within text editors
Composable Elements
Flexible layout engine
Powerful data-binding architecture
Impressive print, font and document
capabilities
Lookless controls
Styles and Templates
Full integration of all UI disciplines
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
Create WPF application with
Visual Studio 2008
Expression Blend
A WPF application is managed code
It runs on the .NET 2.0 runtime
Some classes similar to the WinForms model
Application class
Has Window class instead of Form class
Use .Show() or .ShowDialog to display
Page class for forward/back navigation
Host WinForms controls on WPF window
Host WPF controls on Winform forms
Demo
Creating WPF application in Visual Studio 2008
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
XAML is a declarative programming language
Tool friendly: Easy to persist UI structure in XAML
Expression Blend, ZAM 3D, Visual Studio
XAML is parsed by dedicated parser
Parser converts the tree of XML into a instances of
objects
Most .NET types can be stored in XAML tree
Most likely that these will be Visual items
WPF, Silverlight, XPS & WF use XAML
Silverlight is a sub-set of WPF XAML
<Canvas
xmlns="http://schemas.microsoft.com
/client/2007”>
<TextBlock FontSize="32"
Text="Hello world" />
</Canvas>
Hello world
<TextBlock FontSize="32"
Text="Hello world" />
=
TextBlock t = new TextBlock();
t.FontSize = 32;
t.Text = "Hello world";


Is a Drawing Surface
Children have relative positions:
<Canvas Width="250" Height="200">
<Rectangle
Canvas.Top="25" Canvas.Left="25"
Width="200" Height="150"
Fill="Yellow" />
</Canvas>
The Canvas
The Rectangle

Position relative to first Canvas parent:
<Canvas Background="Light Gray">
<Canvas Canvas.Top="25" Canvas.Left="25"
Width="150" Height="100"
Background="Red">
<Ellipse Canvas.Top="25"
Canvas.Left="25"
Width="150"
Height="75"
Fill=“White" />
</Canvas>
</Canvas>
<Canvas>
<Rectangle/>
</Canvas>
=
Canvas canvas = new Canvas();
Rectangle rectangle = new Rectangle();
canvas.Children.Add(rectangle);


All elements support them
Transform Types




<RotateTransform />
<ScaleTransform />
<SkewTransform />
<TranslateTransform />
▪ Moves
 <MatrixTransform />
▪ Scale, Skew and Translate Combined
<TextBlock Text="Hello World">
<TextBlock.RenderTransform>
<RotateTransform Angle="-45" />
</TextBlock.RenderTransform>
</TextBlock>


Property values can be complex objects
Use “property elements” to represent them in
XML
 <SomeClass.SomeProperty>
<TextBlock>
<TextBlock.RenderTransform>
<RotateTransform Angle="45" />
</TextBlock.RenderTransform>
</TextBlock>
=
TextBlock block = new TextBlock;
RotateTransform transform = new
RotateTransform();
Transform.Angle = 45;
block.RenderTransform = transform;
Demo
XAML
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
WPF includes a flexible, panel based layout engine
What is layout?
Measuring and arranging a region of WPF UI
All layout is handled by panels
Panel has ultimate control over every child
Child size, location, ZOrder
Child location relative to other children
Frees you from hard coding sizes/locations
Mix and combine panels
Each panel handles one type of layout
Canvas:
Absolute positioning
StackPanel: Children stacked horizontal/vertical
WrapPanel: Stacked, with multi children per line
DockPanel:
Attach child to side of panel
Grid:
Create rows/columns for children
Child communicates with host w/Attached properties
Inform their containing panel of desired layout
Example: Grid.Column = "3"
Panel model is extensible with your own panels
Demo
Layout
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
Styles provide a convenient way to itemize a
set of property values for an element type
Example: Set font attributes for all textboxes
To define a Style
Styles are defined in a Resource element
Any element in XAML can have a resource section
Usual locations are Page, Window and Application
level
Every Style in resource must have a x:Key value
Use TargetType to limit style to one element type
To apply a Style to an Element
Reference the Style by setting the Style attribute
Use the Markup Extension syntax '{}'
Demo
Styles
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
Accessing data from WPF
XML
Databases
Ado.NET
Linq to SQL
Linq to Entities
Entity Framework
Invoking Services from WPF
WCF
Soap, REST, WS*
ADO.NET Data Service
Code name Astoria Data Services
Exposes SQL data over HTTP via REST endpoints
Examples: http://localhost/CohoDS.svc/Wines
…Northwind.svc/Customers?$filter=contains(City,'Kent')
Authoring the Data Service
Website
ADO.NET EntityData model
ADO.NET Data Service
Consuming the DataService
Generate proxy with DataSvcUtil.exe
Add proxy code to WPF application
Demo
Databinding
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
Binding overview
WPF synchronizes a data source and data target
Add binding to target element with {Binding ***}
Change notification
WPF dependency system updates target when source changes
Source must implement change notification
Via IPropertyNotifyChanged and other mechanisms
Single binding
Bind a target to a single property on source
Example: TextBlock.Text to Customer.Age
List binding
Bind a target to a array, collection etc.
Example: Treeview. ItemsSource to XML source
Templates provide a convenient way to centralize the replacement
UI for:
Tabular data
Hierarchical data
Controls
Data Template
Define the UI for one Type
Example: Customer class
Render UI with six TextBlocks and one Image
Demo
Data Templates
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
Custom elements
Less need for custom elements in WPF
First consider getting custom look via
Composed UI
Styles
Templates
If you must create custom element choose base:
Existing control
Control
UserControl
User control benefits
Simple
Easy to compose sub-elements into new class
Easily add custom element to UI tree
Control library author
Create custom User Control
Compiled into assembly
Control consumer
Add reference to assembly
Bring your namespace into scope with xmlns
attribute
Demo
User Controls
Discover the top WPF benefits
Creating a WPF application
XAML
Layout
Styles
Using services and databases
Data Templates
User Controls
Control Templates
All controls in WPF are lookless
Each has a default UI template
We can replace default template with our own
control template
Any valid UI element can be part of template
Templates also support binding
Templates do not change behavior of element
Demo
Control Templates
WPF is a rich UI programming framework
Since WPF is managed code, working with .NET
APIs is easy and familiar
Core concept is the composable UI model
Create UI out of any valid WPF element
Mix and merge elements
Formalize these replacement parts with
Styles and Templates
 The WPF Soup to Nuts Webcast Series
Watch Bill Steele as he delves into the details
and explores the inner workings of WPF
visit: http://www.BenkoTIPS.com/wpf
Today’s Schedule
1:00 PM to 1:05 PM – Introduction
1:05 PM to 2:45 PM – WPF Demystified
2:45 PM to 3:00 PM – Break
3:00 PM to 3:30 – Vista Top 10
3::30 PM to 3:45 PM – Break
3:45 PM to 4:50 PM – .NET 3.5 sp1
4:50 PM to 5:00 PM – Raffle
Ten Reasons Your Applications
Are More Secure When Deployed
on Windows Vista™
Developed with security in mind from the outset
Supports buffer overrun protection
Windows Services Hardening
User Account Control
Network Access Protection client
Windows Firewall
Windows Defender
Drive and File Encryption
File and Registry Virtualization
Mandatory Integrity Control
Periodic mandatory security training
Security adviser assigned to each component
Threat modeling as part of the design phase
Security reviews and testing built into the schedule
Security metrics for product teams
Security Development Lifecycle - MSDN
Buffer overruns in C and C++ code
Data Execution Prevention (DEP)
/NXCOMPAT option and NX Group Policy controls
Address Space Layout Randomization (ASLR)
Security Briefs: Protecting Your Code with Visual
C++ Defenses - MSDN
Services run with reduced
privileges
Services are profiled for
allowed actions
Services hardening is
designed to block malware
attempts to write to nonprofile locations
Service Hardening
File system
Registry
Active
protection
Network
Security Watch: Services Hardening in Windows
Vista
All users run as standard
users
When applications require
elevated privileges, UAC
prompts the user
Privilege is elevated only
with the user’s consent
User Account Control
Policy
Network Access Protection (NAP) helpsServers
ensure that
all client computers are compliant with health
policies before they access the network
Update
NAP works on four levels:
Servers
Restricted
Network
Network
Windows
Validates
policyPolicycompliance
Server
Vista Client
DHCP, VPN
Switch/Router
Restricts access per policy compliance
Corporate Network
Remediates as necessary
Grants access as appropriate
3
1
2
Not policy
compliant
4
Policy
compliant
5
On by default in
Windows Vista
Users and administrators
create exception lists
Use APIs to customize
the firewall settings
Windows Firewall and Windows Firewall with
Advanced Security
Alerts users when
spyware attempts to
install or run
Scans on demand or on
a schedule and removes
unwanted software
Notifies users when
definitions are out of
date
BitLocker™ Drive Encryption protects all data on the
hard drive
Volume is encrypted with:
Full volume encryption key (FVEK)
Volume master key (VMK)
Encrypting File System (EFS) encrypts files and folders:
Smart card-enabled for single sign-on
Allows legacy applications to access protected
resources
Creates a private copy of the protected resource for
the user
Write operations that applied to all users now apply
to individual users
Registry Virtualization in Windows Vista
Controls access to securable objects
Defines integrity levels in which processes execute:
Low
Medium
High
System
Restricts communication between a user or process and other
processes or resources with a higher integrity level
Mandatory Integrity Control
Active Directory® Rights Management Services client
Windows Vista device Group Policy
Windows Security Center
Redesigned logon architecture
Easier Smart card deployment
Upgraded support for cryptography
Windows Process Activation Service (WAS)
Windows Vista 64-bit security
Windows Vista was designed with security in mind
Windows Vista works more securely than previous
versions of Windows
Windows Vista features help you ensure client
computers remain secure
Today’s Schedule
1:00 PM to 1:05 PM – Introduction
1:05 PM to 2:45 PM – WPF Demystified
2:45 PM to 3:00 PM – Break
3:00 PM to 3:30 – Vista Top 10
3::30 PM to 3:45 PM – Break
3:45 PM to 4:50 PM – .NET 3.5 sp1
4:50 PM to 5:00 PM – Raffle
Building Applications
with Visual Studio
2008 SP1
What’s being delivered with Service Pack 1
What’s being improved in Service Pack 1
How you can use it to build applications
.NET Framework Application development
Visual Studio 2008
Object-Relational Mapping
ASP.NET
Level 100
New features
.NET 3.5 Additions
Visual Studio Support
Demos!
Enhancements
Framework Improvements
Visual Studio IDE
ADO.NET Entity Framework
ASP.NET Dynamic Data
ADO.NET Data Services
ASP.NET Routing
Entity Data Model
Entity Framework
Visual Studio Designer Support
Maps concepts to physical store
Conceptual Schema Definition
Storage Schema Definition
Mapping Specification
Decouples your DB schema from your application
model
Provides flexibility
Platform-independent
Entity Framework
Object Services
Entity Client
EntitySQL
Linq-to-Entities
Visual Studio Designer Support
Entity Data Model Wizard
Simplifies creation of mapping files
Data Model Design Surface
Simplifies creation of entities and relationships
Hides the complexity of the mapping files
Demo
Created an Entity Data Model from an existing
database schema
Explored the ways to customize the model
Wrote a client application that uses the model to
access data using Linq-to-Entities
Data-driven web application scaffolding
Based on top of object model
New Visual Studio ASP.NET project types
Entity Data Model
Linq-to-SQL
Demo
Created a Dynamic Data Web application
Explored customization areas
Connected it to our existing model
Exposes data “feeds”
Presents a Web-based object model
Powerful, but secure
Extensible
Implemented using Atom Publishing Protocol
“Tables” == feeds
“Rows” == entities
RESTful protocol
Simple XML
URI points to resource
Opt-in exposure
Provides hooks for queries and operations
Supports many types of client access
Demo
Added a Data Service to our Web Application
Refactored our user interface to work over the Web
Map your application’s URL entry points to route
handlers
Generate URLs based off your defined route table
Can be leveraged by ASP.NET…
Dynamic Data
MVC
WebForms
Demo
Explored how to customize site layout using routes
Added new routes to our Web Application
New features
.NET 3.5 Additions
Visual Studio Support
Demos!
Enhancements
Framework Improvements
Visual Studio IDE
ASP.NET AJAX
WCF
WPF
WinForms
History
Creates custom history points
Server & client-side
Enable back/forward browser buttons
Allow users to bookmark state
Script combining
Combine multiple JavaScript files into one
Reduces # of requests and bandwidth
Scalability improvements
DataContractSerializer improvements
APP support added to the syndication library
Enhanced UriTemplate syntax
Compound segments ({filename}.{ext})
Default values (/Products/{id=23})
Performance improvements
Up to 40% coldstart improvement!
Shader effects
Improved Databinding
Direct3D Interop
Images
Textures
Five New controls
Vector Shapes
Line
Rectangle
Oval
PrintForm
DataRepeater
Entity Data Model designer
JavaScript formatting and code preferences
ASP Intellisense/Debugging
.NET Framework Client Profile
26mb download
SQL Server 2008
Improved JavaScript Intellisense
jQuery
Prototype
Scriptaculous
Web designer performance improvements
WCF refactoring support (svc/config files)
ASP.NET MVC
Silverlight 2
ASP.NET Silverlight controls
Great new features in SP1 make
application development easier
Many existing features are improved
More coming soon!
For More Information
Visit MSDN at
http://msdn.microsoft.com
Visit the Windows Client site for downloads & more
http://windowsclient.net/
Subscribe to my blog:
http://msdn.microsoft.com/lindsay
Book Recommendations
These books can be found and purchased at all
major book stores and online retailers
RAMP-UP
•Are you ready to take your career as a developer to the next level?
•Looking for a learning experience that is designed for you?
Join MSDN Ramp Up and Summit Your Career!
MSDN Ramp Up is your online source that provides free training and
technical resources to help take your development skills to the next level.
• Step-by-Step training plans to build your development skills.
• Premium technical content created by expert developers for developers.
• Access to valuable online e-learning, e-references, and virtual labs.
• 50% discount on select certification exams and 30% discount on
Microsoft Press training kits.
Join Ramp Up for free today!
Go to: http://msdn.microsoft.com/rampup
Download