IEDOTNETUG Silverlight Class Week 6
Upcoming SlideShare
Loading in...5
×
 

IEDOTNETUG Silverlight Class Week 6

on

  • 522 views

Slides from the Inland Empire .NET User's Group Silverlight class

Slides from the Inland Empire .NET User's Group Silverlight class

Statistics

Views

Total Views
522
Views on SlideShare
522
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 1. Vector graphics Transform Animation HD Video   2. Binary compatible (XAP Files) No need to target separate platforms.   3. Multi language : C#, VB, IronPython, F#.   CLR is same.

IEDOTNETUG Silverlight Class Week 6 IEDOTNETUG Silverlight Class Week 6 Presentation Transcript

  • Silverlight 4 Course
    • Introduction to Silverlight
    • Layout
    • Input Handling
    • Applications, Resources, Deployment
    • Data Binding, View Model
    • Out of Browser, File Access, Printing
    • WCF RIA Services (4 Weeks )
  • Silverlight Week 6
    • Agenda  
    • Out of Browser
    • Printing
    • File Access
    • IsolatedStorage
    • ClassProject
  • Out of Browser
    • Out of Body Experience ?
    • SL started as plugin for Media.
    • SL 3 allowed OOB. Partial Trust.
    • Allows your app to work offline without Internet connectivity.
    • SL 4 enhanced OOB. Allowed Elevated Trust.
    • Elevated Trust allows :
      • Access to local file system.
      • COM Automation in Windows Systems.
      • Sizing and moving of windows, custom window chrome
      • Full screen means better media experience, more desktop pixels.
    • Notification API : Also called Toast.
    • SL provides API to check OOB mode, Network access, etc.
  • OOB + -
    • OOB does not have access to HTML DOM, Browser Javascript, other in page assets.
    • 25MB instead of 1MB. Can be increased by prompting user.
    • Access to Function Keys F1,F2.
    • Can be pinned to Start Menu or Task Bar in Windows 7.
    • In browser provides automatic update whereas OOB needs an expicit check.
  • OOB Install/UnInstall
    • Right click and select in context menu.
    • Or provide a button to install as OOB.
    • Files gets copied to some location.
    • No registry entries, admin rights, no DLLS needed.
    • Just a prompt to specify Shortcut location.
    • To uninstall :
      • Right click and say “Remove this App”
      • Control Panel ‘s Add/Remove Programs.
  • OOB
    • Use OOB dialog from Project Settings to set the OOB settings. Goes into OutofBrowserSettings.xml.
    • API:
      • Application.Current.Install() : installs it.
      • Application.Current.InstallState
        • Installed
        • Installing : Probably install additional support files.
        • Not Installed
        • Install Failed
      • Application.Current.IsRunningOutOfBrowser
  • DEMO
    • XAML :
      • Grid1 : “Install” button.
      • Grid2 : TextBlock : “Running out of browser”
      • Both Grids collapsed.
    • Code Behind
      • Utility method :
        • If Current not installed uncollapse grid1.
        • If Current is installed uncollapse grid2 and collapse grid1.
      • Call install in Install handler
    • DEMO : Can someone do it, please ?
    • Call Install() from constructor. What happens ?
  • Install()
    • What about Security ?
      • Rogue Silverlight apps could just call Install() in constructor.
    • Nope. You can call Install() only from UI event.
  • Printing
    • Why do we need Printing ?
  • Printing
    • Create PrintDocument.
    • Attach to PrintPage event.
      • Create PrintLayout and set the width/height to PrintPageEventArgs.PrintableArea.Width/Height.
      • Set “PrintPageEventArgs.PageVisual” to any UI element. Nor necessarily one on the screen. If needed you can create a new one too.
      • Set HasMorePages property to TRUE for subsequent pages.
    • Call PrintDocument.Print(). Provide a title for the print job.
  • Printing
    • Demo
    • Bitmap printing.
  • File Access
    • 3 options :
    • 1. OpenFileDialog and SaveFileDialog : SL does not know the location of the file.
    • 2. FileStream, StreamWriter : Elevated Trust
    • 3. Isolated Storage.
  • Open/SaveFileDialog
    • User interaction needed.
    • User selects the file.
    • OpenFileDialog has a multiSelect property to allow multiple selection.
    • Demo.
  • Isolated Storage
    • Per application.
    • Better than Cookie. No 4K limit.
    • 1MB limit. Can ask for more if needed.
    • Works across Cross browser.
    • IsolatedStorageFile.GetUserStoreForApplication
    • IsolatedStorageFileStream
  • IsolatedStorageFile
    • System.IO.IsolatedStorage Name space.
      • GetUserStoreForApplication()
      • GetUserStoreForSite()  Not available in .Net Full
      • GetDirectoryNames()  Supports Wild cards for pattern matching. Returns string[]
      • GetFileNames()  Supports Wild cards for pattern matching. Returns string[]
      • DeleteFile()  Absolute path needed
      • DeleteDirectory()  Absolute path needed
      • CreateDirectory()
      • Quota & AvailableFreeSpace Properties
      • IncreaseQuotaTo()  Total number of bytes to increase to and not delta
      • Create IsolatedStorageFileStream() object to create new files. “filemode” enumerator.
      • Needs to be disposed of. So use “using”.
  • Class Project
    • Create a trusted app with 3 buttons : Create Dirs, Del Dir, Create File and a textblock.
    • CreateDirs should create “Dir1/text1.txt” & “Dir2/text2.txt” and “Dir2/text3.txt” and “Dir3/text4.txt”.
    • TextBlock should show the content of “Dir2/text3.txt”.
    • Del Dir should delete “Dir2”. Once deleted textblock should be empty. Use binding. Also notify using toast.
    • Create File button should create “Dir2/text3.txt”. Use command to enable/disable it.
    • Notify Button :
      • NotificationWindow hello = new NotificationWindow()
      • Notify.height = notify.width = 100;
      • Nottify.Content = textblock;
      • Notify.Show(5000);