Silverlight 4 Out Of Browser


Published on

This is my presentation on the Out-of-Browser features of Silverlight 4 that I gave at Toronto Code Camp 2010

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Silverlight 4 offers the ability to initialize and use COM+ classes from Silverlight. It should be noted that these features are only available in elevated privileges Out-Of-Browser mode and are not available in-browser.   In Silverlight 4 Com+ Automation only works on Windows machines (but more on that later). The majority of work around Silverlight 4 COM+ support is centered around the ComAutomationFactory and ComAutomationEvent classes. Freaked out? Get over it. Silverlight 4 COM+ Automation is not about authoring, deploying or versioning COM+ components, that is a worst practice for this feature.   The best practice for Silverlight 4 COM+ is to only use common operating system COM+ classes, and not ship your own.Given that best practice, you are just the consumer of some time tested Windows APIs. Using COM+ Windows APIs is no different then consuming the .Net framework, 3rd party frameworks or p/Invoke features. 
  • Demo how to create a Silverlight application that supports out-of-browser and elevated privileges
  • Demo how to write files locally
  • Demo reading a local file
  • Demo running an application
  • Clipboard.GetTextInstallButton.Drop += new DragEventHandler(InstallButton_Drop); InstallButton.DragOver += new DragEventHandler(InstallButton_DragOver); InstallButton.DragEnter += new DragEventHandler(InstallButton_DragEnter); InstallButton.DragLeave += new DragEventHandler(InstallButton_DragLeave);
  • COM+ Automation isn’t supported for Macs in Silverlight 4. For a good reason, Mac doesn’t have COM+. However, Microsoft have stated they are looking into getting COM+ support working in Silverlight 4 RTM on a Mac.Macs have similar programmatic access to COM known as AppleScript. It’s not that hard to read once you remove the added spaces and add some indents. Once you get past the syntax, it’s easy to see those are the same classes and members on a Mac as are available for Windows. The point here is that if Microsoft wants to enable Com Automation-like features on a Mac there are 2 options: 1) Enable executing AppleScripts.This option will let us have the same amount of control on a mac machine as we do on a windows machine. 2) Add an overload to ComAutomationFactory.CreateObject() that calls the “Tell Application” command under the scenes and gets a AppleScript object. This option would work extremely well for Office automation. For any other operating system feature, you’ll have to code OS access twice. 
  • [ProgId("SilverlightCOM.Example")][ClassInterface(ClassInterfaceType.AutoDual)][Guid("5267F53A-0E5F-490A-A891-FFE8B3840D72")]public class ComClass{ [ComVisible(true)] public void RunMe() {System.Windows.Forms.MessageBox.Show("Hello from .NET via COM!"); }}
  • Silverlight 4 Out Of Browser

    1. 1. Silverlight 4 Breaks Free<br />Bruce Johnson<br />ObjectSharp Consulting<br /><br />Twitter: @LACanuck<br />
    2. 2. Silverlight 4<br />Revenge of COM!!!!!<br />
    3. 3. Elevated Privileges<br />
    4. 4. Checking for Updates<br />
    5. 5. Write Files Anywhere<br />
    6. 6. Reading a Local File<br />
    7. 7. Running an Application<br />
    8. 8. Toast, Anyone?<br />
    9. 9. Pinning the App to the Taskbar<br />
    10. 10. Printing my XAML<br />
    11. 11. HTML Hosting<br />
    12. 12. Using External Devices<br />
    13. 13. Watching a Local File<br />
    14. 14. Is there anything else?<br />Clipboard access<br />Full-keyboard access in kiosk mode<br />Cross-domain network access<br />Drop target for drag-drop functionality<br />
    15. 15. But I’m a Mac!!???<br />
    16. 16. What About My Own Components?<br />
    17. 17. Questions?<br />Twitter: @LACanuck<br />Blog:<br />Email:<br />