Is it possible to run the Silverlight 4 OOB application from a web page?

I plan to create a download manager application and would like to be able to run the application when the user clicks a button on the site. Obviously, the application must be installed on the client machine.

There are several reasons why this should be written using Silverlight, but they are not relevant. I only mention this so that people do not offer to use another technology.

+3
source share
5 answers

I think this is not possible according to this post 1 post and another post . But I don’t know if MS will change this in the latest version of SL 4

+2
source

Performing a bit of confusion from the other two messages [ 1 ] and [ 2 ].

But of course, this will only work for Windows, not for Mac. There you will have to return to the @ michael-s-scherotter solution .

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

    }
}
+1
source

, Silverlight OOB silverlight . .

using (dynamic shell = AutomationFactory.CreateObject("WScript.Shell"))
{
    shell.Run(launchPath);
}

, :)

0

, , .

OOB.

(, ):

if (Application.Current.HasElevatedPermissions && Application.Current.InstallState == InstallState.Installed)
{
    string launcherPath = string.Empty;
    using (dynamic shell = AutomationFactory.CreateObject("Shell.Application"))
    {
        string launcher64 = @"C:\Program Files (x86)\Microsoft Silverlight";
        string launcher32 = @"C:\Program Files\Microsoft Silverlight";

        dynamic folder64 = shell.NameSpace(launcher64);
        if (folder64 != null)
        {
            launcherPath = launcher64;
        }
        else
        {
            dynamic folder32 = shell.NameSpace(launcher32);
            if (folder32 != null)
            {
                launcherPath = launcher32;
            }
        }
    }

    using (dynamic shell = AutomationFactory.CreateObject("WScript.Shell"))
    {
        var origin = Application.Current.Host.Source.OriginalString;
        var launchCmd = string.Format(@"""{0}\sllauncher.exe"" /uninstall /origin:""{1}""", launcherPath, origin);
        shell.Run(launchCmd);
    }
}

( : http://www.wintellect.com/blogs/sloscialo/programmatically-uninstalling-silverlight-out-of-browser-application)

0

Source: https://habr.com/ru/post/1748167/


All Articles