2011-08-23 8 views
7

Estoy tratando de usar SLLAUNCHER.EXE para iniciar una aplicación SL fuera de navegador que está instalada. El icono de inicio de MyApp en el escritorio simplemente desaparece después de ejecutar el siguiente. Si lo intento sin el interruptor de sobrescritura no pasa nada.Ejecute la aplicación Silverlight Out of Browser Programmatically

estoy usando este artículo como una guía:

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

Cualquier sugerencia sería apreciada.

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

¿Funciona o hay una pregunta? – kenny

+0

Estoy tratando de hacer lo mismo para que funcione. Parece que puede haber un error en Silverlight 4, lo que hace que sllauncher.exe falle silenciosamente. En cualquier caso, continuaré investigando. Tal vez hay una solución. https://connect.microsoft.com/VisualStudio/feedback/details/575052/sllauncher-exe-fails-silently-and-runs-nothing-with-emulate-option –

+0

Intenté exactamente el mismo código con mi aplicación con la esperanza que simplemente podría usar una aplicación externa para iniciar programáticamente mi aplicación OOB silverlight instalada en la misma caja y obtener los mismos resultados. El acceso directo de mi escritorio a mi aplicación OOB desapareció y apareció una ventana para OOB silverlight. Paso los parámetros init en mi versión alojada, lo que hace que no cargue OOB, así que no estoy 100% cargado como se esperaba todavía, pero aparece una ventana con el título esperado en la barra de título de la ventana. –

Respuesta

0

¿Está utilizando una máquina de 64 bits? http://social.msdn.microsoft.com/Forums/en-US/silverlightcontrols/thread/abedb9dc-d471-4d82-8a20-45f98671cac9

Podría allso ayuda: Así es como me vuelva a empezar desde dentro de mis SL aplicaciones fuera de banda después de que detecto actualización se ha completado:

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

Usted podría intentar adaptar el código para su no-SL aplicación!

THT

Cuestiones relacionadas