Silverlight 5 Advanced Ronnie Saurenmann Principal Architect Microsoft Switzerland [email protected] Unlimited power Save as Dialog New Default file name.

Download Report

Transcript Silverlight 5 Advanced Ronnie Saurenmann Principal Architect Microsoft Switzerland [email protected] Unlimited power Save as Dialog New Default file name.

Silverlight 5 Advanced
Ronnie Saurenmann
Principal Architect
Microsoft Switzerland
[email protected]
Unlimited power
Save as Dialog
New Default file name
In Browser Trusted Apps
SL4: OOB apps run trusted with user consent
SL5: in-browser trusted apps with admin consent
Set permissions via group policy
Uses Authenticode certificate
No prompts or installs
Trusted Apps
Sandboxed
App
Trusted
SL4 App
Trusted
SL5 App
Prompt-free
No
Yes
Yes
Cross domain networking
No
Yes
Yes
Full keyboard in full screen
mode
No
Yes
Yes
COM
No
Yes
Yes
Unrestricted file access
No
Kinda*
Yes
P/Invoke
No
No
Yes
Run in-browser
No
No
Yes
Creating a Trusted App
Just like SL4 trusted OOB
<OutOfBrowserSettings>
<OutOfBrowserSettings.SecuritySettings>
<SecuritySettings
ElevatedPermissions="Required" />
</OutOfBrowserSettings.SecuritySettings>
</OutOfBrowserSettings>
Creating a Trusted App
Sign the .xap
Same as for a trusted OOB
In Visual Studio or on command line
or
signtool.exe sign /v /f
nameOfCert.pfx
/p "<password>"
nameOfApp.xap
Permissions in Group Policy
Actually, only one permission – trusted or not
Network admin specifies which publishers are trusted
Same as ClickOnce
Xaps are associated with publishers by Authenticode
Apps from localhost: are automatically trusted
Unrestricted File Access
P/Invoke
P/Invoke lets you call native code
COM (SL4) also lets you call native code
Anything you can do with COM can also be done with
P/Invoke
Strongly typed
No COM registration
P/Invoke is optimized for Win32 APIs & native C/C++
code
COM is optimized for COM Automation APIs, eg Office
COM & P/Invoke are available on Windows to trusted
apps
P/Invoke
Works exactly like it does in .NET Framework
[DllImport("kernel32.dll")]
static extern int GetDriveType(string
lpRootPathName);
…
int type = GetDriveType(drive);
WebBrowser In-Browser
Use HTML inside Silverlight apps
To reuse existing HTML/ASP.NET content
To integrate with outside websites
In SL4, only OOBs got WebBrowser (WebOC)
In SL5, in-browser WebBrowser support
(WebOC/IE)
Trusted only!
Markup Extensions
Custom Markup Extensions
Relative Source Ancestor Binding
Used For Control Hierarchy Binding
<DataTemplate x:Key="StateComboBoxDataTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding StateCode}" Margin="0,0,5,0"/>
<TextBlock Text="{Binding StateName}"
Visibility="{Binding IsDropDownOpen,
RelativeSource={RelativeSource FindAncestor
AncestorType=ComboBox},
Converter={StaticResource BoolToVisibilityConverter} }"/>
</StackPanel>
Text Clarity
Sharpens text by snapping with pixels
Great for low res devices
Vector Printing
Spool Time
Text
Shapes
Bitmap
Vector
0
200
400
600
800
(milliseconds)
File Size Sent to Printer
Text
Shapes
Bitmap
Vector
0
20
40
60
80
(MB)
100
120
140
Text Enhancements
Text Tracking
Text Leading
Linked Text Containers
Flow Rich Text from one container
to another
Dynamically flows on resize
<RichTextBox
OverflowContentTarget="{Binding ElementName=overflow1}">
<RichTextBoxOverflow x:Name="overflow1"
OverflowContentTarget="{Binding ElementName=overflow2}">
<RichTextBoxOverflow x:Name="overflow2"
OverflowContentTarget="{Binding ElementName=overflow3}">
...
Performance
Faster Startup
Multi‐core background JIT support for improved startup
performance.
XAML Parser performance optimizations
Improved Graphics stack
The graphics stack has been re‐architected
Bring over improvements from WP7, such as Independent
Animations.
Network Latency optimizations
Text layout performance improvements
Hardware acceleration is enabled in windowless mode with
Internet Explorer 9
64-bit Support
64-bit machines & apps are becoming
increasingly common
SL5 can run in a 64-bit process
64-bit browsers
Sidebar on 64-bit Windows
Profiling with Visual Studio 2010
In Visual Studio SP1
Works already for SL4
Media
Variable Speed Playback
Pitch Correction (not yet in Beta)
+32x to -32x
H.264 Hardware Decode
Remote Control Support
3D Feature Intro
High-level components
Drawing Surface control to compose 3D within a page
Core of XNA Graphics from Game Studio 4
GPU access via immediate mode drawing APIs
Shader model 2.0 using HLSL
Built-in effects and custom shaders
3D Feature Intro
Runtime requirements
WPF vs. Silverlight 3D
WPF 3D
• Retained rendering
model
• Higher level API
• Some scenarios require
more control
Silverlight 3D
(XNA Graphics)
• Immediate rendering
model
• Direct control,
performance, flexibility
• Web version includes
core graphics APIs
• Low level API
Third Party 3D Engines
Can now be fully HW accelerated
layered on top of XNA
Balder (http://balder.codeplex.com/
Higher level API
Easy to use
XAML based
.ase import
Babylon (http://david.blob.core.windows.net/babylon/Babylon.html
XNA based
Collisions
Textures (including light maps)
Per-pixel & per-vertex shader
Models/cameras and lights
3D Max import
Where to start?
http://www.silverlight.net
© 2011 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.