单击按钮即可安装 silverlight 应用程序

Install silverlight application on button click

本文关键字:silverlight 应用程序 安装 按钮 单击      更新时间:2023-09-26

我正在寻找一种解决方案,如果他在网络浏览器中单击(安装按钮(,将银光应用程序安装到用户系统中。

我知道怎么做 浏览器外,但这里的要求不是右键单击和安装,它需要从HTML5网页按钮单击事件安装。

我知道可以从银光按钮单击中实现,但我想从HTML5按钮单击事件中实现这一点

private void Button_Click(object sender, RoutedEventArgs e)
{
    if (Application.Current.HasElevatedPermissions && System.Windows.Interop.ComAutomationFactory.IsAvailable)
    {
        string run = "'"%ProgramFiles%''Microsoft Silverlight''sllauncher.exe'" /emulate:Silverface.xap /origin:'"http://www.silverlight.net/content/samples/apps/facebookclient/ClientBin/Silverface.xap'" /overwrite";
        dynamic cmd = ComAutomationFactory.CreateObject("WScript.Shell");
        cmd.Run(run, 1, true);
    }
}

谢谢

不可言喻的p

如果你的 silverligt 应用程序加载到页面上,你可以从 javascript 调用 silverlight 的安装方法。

演练:从 JavaScript 调用托管代码

我已经找到了答案,要处理这个问题,我需要使用 HTA 文件http://www.silverlightshow.net/items/How-to-distribute-a-Silverlight-OOB-Application.aspx

相关文章: