Host xbap in standalone RRS feed

  • Question

  • Hi guys, I need help! What I want to do is to create a standalone that can host an xbap, instead of hosting the xbap in a browser. Sort of like what adobe has done with their speed launcher for adobe reader. (start part of the program at booting and the rest when the user clicks on the xbap link) The idea is to shorten startuptime. I want to create a mimetype for my xbap that points to my standaloneapplication. Is that in any way possible? Any ideas about this?

    Wednesday, October 7, 2009 8:31 AM


  • Hi ah22er,

        Should be easily possible... to host an Xbap inside a plain WPF application, you simply have to add a Frame or WebBrowser control,  and set the Source property of this control to the path to your Xbap.  Im not so sure that it will provide much of a performance improvement (if any), since the overhead of hosting the WPF window in the browser is relatively small compared to the cold-start loading time for WPF and .NET assemblies. 

    I want to create a mimetype for my xbap that points to my standaloneapplication. Is that in any way possible?

    - Sort of... you can add MIME types arbitrarily by writing the appropriate values to the registry, but not from a partial-trust Xbap.   From a fully-trusted Xbap (see Trusted App overview here if you havent: http://msdn.microsoft.com/en-us/library/01daf08f.aspx ), or obviously using your full-trust .application you could register a MIME type. 
    - However, since ClickOnce apps are stored per-user, and can be deleted / removed without your knowing, registering a MIME type to point to a ClickOnce app is not a good idea!

    Any ideas about this?

    - I think to achieve what you want, you could simply use a Hyperlink that points to your standalone .application, and then have your standalone application launch your Xbap if you so please.  To ensure that you always launch the .xbap again within the application with the same URL (an important-ish consideration to prevent re-download of your xbap) you can pass some part of System.Windows.Interop.BrowserInteropHelper.Source as a query string for your .application (i.e. construct a Url like http://www.foo.com/bar.application?www.foo.com/baz.xbap from within the Xbap using the above property at runtime).

    - If performance is your thing, consider refactoring your Xbap instead.  If you can easily break up the code and resources into separate file groups, you can then download them only as needed using the DownloadFileGroupAsync method (http://msdn.microsoft.com/en-us/library/system.deployment.application.applicationdeployment.downloadfilegroupasync(VS.80).aspx)

    Hope this helps,
    SDET : Deployment/Hosting
    • Marked as answer by Bruce.Zhou Tuesday, October 13, 2009 12:09 PM
    Wednesday, October 7, 2009 4:57 PM