5

您可以强制 Silverlight 仅在浏览器外运行吗?

编辑:我问的原因是因为 Silverlight 的很多功能只适用于 OOB。如果我的应用程序依赖于此,我需要要么要求 Silverlight 应用程序在该模式下运行,要么选择其他东西。

4

2 回答 2

9

Application_Startup甚至在 App.Xaml.cs中使用它怎么样:-

private void Application_Startup(object sender, StartupEventArgs e)
{

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

现在创建一个非常简单的 UserControl 调用PleaseRunOOB来向用户展示安装和/或运行应用程序的 OOB 版本的需要。

于 2011-04-05T19:03:40.223 回答
4

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

新的 OOB 模型存在的附加功能是能够不是从网页安装应用程序(就像从版本 3 开始一样),而是从命令行(有可用的 XAP 文件)安装应用程序。Silverlight 4 OOB 启动器具有新的命令行参数,可以在“仿真模式”下安装、卸载和执行应用程序——无需安装。

例如。要在桌面上安装应用程序,请使用以下命令:

"%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

要卸载它,请使用以下命令:

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

要在不安装的情况下运行应用程序(在仿真模式下),请使用以下命令:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /emulate:"X:\PACKAGE_LOCATION\APPLICATION.xap" /origin:http://ORIGINAL_LOCATION/
于 2011-04-05T18:28:24.367 回答