微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

以编程方式启动Silverlight Out of Browser App

我正在尝试使用sllAUNCHER.EXE来启动已安装的SL Out-of-browser应用程序.运行以下内容后,桌面上的MyApp启动图标就会消失.如果我尝试没有覆盖开关没有任何反应.

我正在使用这篇文章作为指南:

http://timheuer.com/blog/archive/2010/03/25/using-sllauncher-for-silent-install-silverlight-application.aspx

任何建议,将不胜感激.

static void Main(string[] args)
    {
        string sllauncherPath = string.Format("{0}\\Microsoft Silverlight\\sllauncher.exe",Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));

        string originUri = @"http://localhost:52878/ClientBin/MyApp.xap";
        string xap = "MyApp.xap";
        string arg = string.Format(@"/emulate:""{0}"" /origin:""{1}""  /overwrite",xap,originUri);

        var startInfo = new processstartinfo
        {
            CreateNowindow = false,UseShellExecute = false,RedirectStandardOutput = false,FileName = sllauncherPath,Arguments = arg
        };

       var process = Process.Start(startInfo))

    }

解决方法

你使用64位机器吗?
http://social.msdn.microsoft.com/Forums/en-US/silverlightcontrols/thread/abedb9dc-d471-4d82-8a20-45f98671cac9

还可以帮助:
这是我在检测到更新完成后从我的SL OOB应用程序中重新启动的方式:

''put this in your App.xaml.vb[.cs] and call DoRestart
Public Shared Sub DoRestart()
    StartAgain()
    Application.Current.MainWindow.Close()
End Sub
Public Shared Sub StartAgain()
    If Not [String].IsNullOrEmpty(GetsllauncherCommand) Then
        Using shell = AutomationFactory.CreateObject("WScript.Shell")
            shell.Run(GetsllauncherCommand)
        End Using
    End If
End Sub
Public Shared Function GetsllauncherCommand() As String
    Dim desktopPath As String
    Dim sllauncherCommand As String = ""
    Using wShell As Object = AutomationFactory.CreateObject("WScript.Shell")
        desktopPath = wShell.SpecialFolders("Desktop")
    End Using
    Using shell As Object = AutomationFactory.CreateObject("Shell.Application")
        Dim DesktopFolder As Object = shell.[NameSpace](desktopPath)
        Dim DesktopItems As Object = DesktopFolder.Items()
        For Each item In DesktopItems
            If item.IsLink Then 'this is a shurtcut
                Dim fileName As String = item.Name.ToLower()

                If fileName.Contains("!!!<PART OF YOUR SL APPS SHORCUT NAME>!!!!") Then
                    Dim link = item.GetLink()
                    sllauncherCommand = """" & Convert.ToString(link.Path) & """ " & Convert.ToString(link.Arguments)
                End If
            End If
        Next
    End Using
    Return sllauncherCommand
End Function

您可以尝试调整非SL应用程序的代码

THT

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐