November 7, 2015 Ashish Shetty Program Manager | Microsoft Silverlight http://nerddawg.blogspot.com - Jim Gray.
Download
Report
Transcript November 7, 2015 Ashish Shetty Program Manager | Microsoft Silverlight http://nerddawg.blogspot.com - Jim Gray.
November 7, 2015
Ashish Shetty
Program Manager | Microsoft Silverlight
http://nerddawg.blogspot.com
- Jim Gray
In Silverlight 3
Smart defaults
Run same app in and
out of browser
With built-in updating
Your app works on and off the grid
25MB Isolated Storage default gives you more room to
stretch
code | demo
In Silverlight 4
New &
Improved
Web Browser hosting
Window customization
Toast notifications
Offline DRM media playback
Silent install/uninstall support
Install-free “emulation mode”
run
Trusted Apps
Silverlight
$
Web content
• Navigate to URL
<WebBrowser
Source="http://any.site"
Height="…"
Width="…"
ScriptNotify="…"
/>
• Get/Set markup as a
string
• 2-way interop
• Supports browser plugins and doc objects
• Flash, PDF, Visio etc.
• “Windowed” hosting
• Enables layering of
HTML and Silverlight
• Opacity, rotation,
effects, stretch/skew
• HTML content is notinteractive
<WebBrowser
Source="http://any.site"
x:Name="foo"
/>
…
<Rectangle>
<Rectangle.Fill>
<WebBrowserBrush
SourceName="foo"
Opacity="0.5"
Stretch="…"
/>
</Rectangle.Fill>
</Rectangle>
top, left
Startup location
Dimensions of
client area
TopMost
Activate() and
IsActive
Close() and
Cancellable
Closing event
height
width
topmost
Rectangular
400 x 100 px
max
30 secs max
Can activate
main window
You have 325
new voicemails
Listen
x
NotificationWindow toast = new NotificationWindow();
toast.Content = new ToastContent();
toast.Content.MouseLeftButtonUp += (s, arg) =>
{
Application.Current.MainWindow.Activate();
};
toast.Show(4000);
code | demo
New
Business
Models
• Subscription
• Rental
• Purchase
New
Features
• Persistent license storage
• Time based policies
• Secure H.264 and AAC
decoders
• Support for Output
Protection
Enterprise installs via scripts, installers or
executables
sllauncher.exe /install:"somePath\myApp.xap"
/origin:"http://any.site.com/myApp.xap"
/shortcut:desktop+startmenu
/overwrite
sllauncher.exe /uninstall
/origin:"http://any.site.com/myApp.xap"
Platform
Specific Usage
For developer tools; Or if deploying via CD,
DVD, USB media
sllauncher.exe /emulate:"somePath\myApp.xap"
/origin:"http://any.site.com/myApp.xap"
/overwrite
Platform
Specific Usage
Because not all apps
can play in the
sandbox
File system access
Device access
Interop with external components
Access to features not yet in
Silverlight
No trusted operations
possible within the
browser
No consent No trust
No install
Group Policy hooks to
disable install, activation
With great power comes
great responsibility
Per-user app, not
system-wide
Runs with standard user
privileges, not admin
Great defense in depth
with UAC on
[recommended!]
Set expectations with
consumer user
Sign your XAPs!
New &
Improved
Removed Sandbox speed bumps
File System Access
Native Integration
Window Chrome customizations
Digital Signing of XAPs
Cross-domain policy in networking
http
&
sockets
Socket port range restrictions
4502 - 4534
Restrictions on full File path *
OpenFileDialog
&
SaveFileDialog
User initiation requirements
File
dialogs
Clipboard
access
FullScreen
mode
Changing
Window
settings
Restrictions on Keyboard input in FullScreen
mode
Yes, really
Access to “My Files”
Documents
Pictures
Music
Videos
Types from System.IO
File
Directory
Environment
Etc.
Creating a new video file
// defensive code == portable code
if (Application.Current.HasElevatedPermission) {
// look ma, no path hard-coding!
// this code works on Mac, Windows, everywhere
string path = Environment.GetFolderPath(
Environment.SpecialFolder.MyVideos );
string mediaFile = Path.Combine(path, "Foo.mp4");
if (!File.Exists(mediaFile) {
using (FileStream fs = File.Create(mediaFile)) {
//...
}
}
}
… via Automation of external / system
components
// defensive code == portable code
if (AutomationFactory.IsAvailable) {
dynamic xl = AutomationFactory.CreateObject("Excel.Application");
xl.Visible = true;
xl.Workbooks.Add();
//...
}
Platform
Specific Code
coming
soon
Supported in Silverlight 4
Not in Silverlight 4
• Property get/set, indexed
property get/set
• Positional and optional
parameters
• Support by-ref and by-value
• In proc and out of proc servers
• Support for basic data types
• VARIANT, BSTR,
SAFEARRAY, IEnumVARIANT
• Silverlight app as event sink
• Multi-dimensional arrays
• Named parameters
• Type Information
• Support for COM Elevation
moniker
Office interoperability
WMI (system information, file watching)
ADO DB
Sensors (GPS)
Speech
Etc.
Consult Automation servers’ documentation
Remove the Shell chrome and window border
Rectangular window
Rectangular window with
rounded corners
code | demo
Applies to Trusted
Apps only
Install and Update –
time enforcements
Use Code Signing
certificates
FOR CONSUMERS
FOR APP AUTHORS
Reassurance on
authenticity and integrity
of app
Clear publisher and
provenance info on app
Better install-time UX
App Icon
Publisher name
Seamless updates
Project Properties pane
Command Prompt
or
signtool.exe sign /v /f
nameOfCert.pfx
/p "<password>"
nameOfApp.xap
Build sticky desktop experiences
More features outside the browser
Harness local data and provide immersive,
latency-free experiences
…by putting the computation near the data
With a little help from our friends
v1.0
XAML +
JavaScript
2
XAP and
managed
code
3
Beyond
the
browser
4
Trusted
apps
Matryoshka doll
Lock
http://www.flickr.com/photos/edvvc/483090647/sizes/m/
Image courtesy of edvvc
License: Creative Commons 2.0 (by)
U.S. Declaration of Independence image is a public domain artifact from the National Archives
http://www.flickr.com/photos/sixthworld/3964450408/sizes/m/
Image courtesy of Thomas Ott
License: Creative Commons 2.0 (by)
Cat stretch
http://www.flickr.com/photos/fenris/33546752/sizes/m/
Image courtesy of abkfenris
License: Creative Commons 2.0 (by)
Children on slide
http://www.flickr.com/photos/re-ality/41676755/sizes/o/
Image courtesy of re-ality
License: Creative Commons 2.0 (by)
Sandbox
http://www.flickr.com/photos/amagill/235453953/sizes/s/
Image courtesy of Amagill
License: Creative Commons 2.0 (by)
Phone connected to laptop
http://www.flickr.com/photos/frangipani_photograph/3066995907
Image courtesy of Frangipani Photograph
License: Creative Commons 2.0 (by-nc-nd)
http://www.archives.gov/exhibits/charters/declaration.html
All logos and icons are trademarks of their respective owners, and are used here only to represent those products or brands