开发者

Deliver desktop-dependent application with Silverlight

开发者 https://www.devze.com 2023-04-13 00:27 出处:网络
Task: I have a Windows executable, for example, convertvideo.exe. It is a command line tool for specific video conversion.

Task:

I have a Windows executable, for example, convertvideo.exe. It is a command line tool for specific video conversion.

I want my clients to be able to easily use it on any machine, without installation. The use-case should be: client goes to a web page, that hosts a silverlight application. Application tells the client to press "put the executable in a temp folder" button. When pressed, the executable is deployed (downloaded, copied) on a client machine. Then silverlight app asks the user to provide the list of files to convert, as well as t开发者_运维问答he path for the result files. The user presses convert, and the silverlight app runs (on a client machine) the convertvideo.exe with the provided parameters to do a conversion.

Question:

Is this possible with the file system access privileges, the Silverlight app has from within the browser?


If you want an in-browser Silverlight app, this is not possible in Silverlight 4. It will be possible in-browser with Silverlight 5, but that has not been released yet.

This can, however, be accomplished with an out-of-browser application in Silverlight 4. See "Building an Out-ofBrowser Application" for tips on how to deliver your out-of-browser app to your users via the browser. The "install" process is just a UAC dialog, pretty minimal.

When running out of browser, you can bundle your .exe as a resource and save it to a known location on disk (caution, though -- SL4 doesn't have full access to the disk, only to certain areas like "My Documents" or isolated storage). To run the .exe, you can use COM:

using (dynamic shell = AutomationFactory.CreateObject("WScript.Shell"))
{
    shell.Run(@"Path\To\Exe\convertvideo.exe arg1 arg2 etc...");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号