Jonathan Allen
Jonathan Allen

Reputation: 70337

Can you force Silverlight to only run Out-of-browser?

Can you force Silverlight to only run Out-of-browser?

EDIT: The reason I'm asking is because a lot of Silverlight's functionality only works OOB. If my application depends on this I need to either require the Silverlight app to run in that mode or pick something else.

Upvotes: 5

Views: 1455

Answers (2)

AnthonyWJones
AnthonyWJones

Reputation: 189545

How about using this in your Application_Startup even in App.Xaml.cs:-

private void Application_Startup(object sender, StartupEventArgs e)
{

     if (IsRunningOutOfBrowser)
     {
          this.RootVisual = new MainPage();
     }
     else
     {
          this.RootVisual = new PleaseRunOOB():
     }
}

Now create a very simple UserControl called PleaseRunOOB to present to the user the neeed to install and/or run the OOB version of the app.

Upvotes: 9

nathan gonzalez
nathan gonzalez

Reputation: 12017

from http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2010/03/15/silverlight-4-quick-tip-out-of-browser-improvements.aspx

Additional feature exist with new OOB model is ability to install application not from the web page (like it was from version 3), but from command line (having XAP file available). Silverlight 4 OOB launcher has new command line parameters to install, uninstall and execute application in “emulation mode” – without installing it.

For example. to install application on the desktop use the following command:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /install:"X:\PACKAGE_LOCATION\SL4Features.Web\ClientBin\APPLICATION.xap"
/origin:http://ORIGINAL_LOCATION/ORIGINAL_HOSTING_PAGE /shortcut:desktop

To uninstall it use the following command:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /uninstall:"X:\PACKAGE_LOCATION\APPLICATION.xap"
/origin:http://ORIGINAL_LOCATION/ORIGINAL_HOSTING_PAGE /shortcut:desktop

To run application without installing it (in emulation mode), use the following command:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /emulate:"X:\PACKAGE_LOCATION\APPLICATION.xap" /origin:http://ORIGINAL_LOCATION/

Upvotes: 4

Related Questions