开发者

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.


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.


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/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜