2011-08-23 14 views
7

SLLAUNCHER.EXEを使用して、インストールされているSL Out-of-Browser Appを起動しようとしています。デスクトップを起動したMyAppの起動アイコンは、以下を実行すると消えます。上書きスイッチなしで試しても何も起こりません。Silverlightをブラウザから外してプログラムを起動する

私はガイドとしてこの記事を使用しています:

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)) 

    } 
+1

問題がありますか? – kenny

+0

私は同じことを働かせようとしています。 Silverlight 4にはバグがあり、sllauncher.exeが黙って失敗することがあります。いずれにせよ、私はそれを調べ続けるでしょう。おそらく回避策があります。 https://connect.microsoft.com/VisualStudio/feedback/details/575052/sllauncher-exe-fails-silently-and-runs-nothing-with-emulate-option –

+0

私は希望で私のアプリケーションとまったく同じコードを試みました同じボックスにインストールされたOOB silverlightアプリケーションをプログラムで起動して同じ結果を得ただけで、外部アプリケーションを使用することができます。私のOOBアプリケーションへの私のデスクトップのショートカットが消え、OOB silverlightのウィンドウが表示されました。私はOOBをロードしないようにする私のホストされたバージョンでinit paramsを渡すので、期待通りに100%ロードされていませんが、ウインドウはウィンドウのタイトルバーに予想されるタイトルでポップします。 –

答えて

0

64bitマシンを使用していますか? http://social.msdn.microsoft.com/Forums/en-US/silverlightcontrols/thread/abedb9dc-d471-4d82-8a20-45f98671cac9

でしallsoヘルプ:これは私は更新が完了した検出した後、私は私の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

関連する問題