开发者

Can you start an outside process with Silverlight?

The System.Diagnostics assembly is part of the Silverlight CLR framework, but it only includes classes related to debugging, the Process class is not available. Is there any other way to start an ou开发者_Go百科tside process from a Silverlight application?


Yes, you can in Silverlight 4 (in out-of-browser with elevated full trust), example:

dynamic cmd = AutomationFactory.CreateObject("WScript.Shell");
cmd.Run("calc.exe", 1, true);


Using an elevated trust out of browser app (shall we coin ETOOB or OOBET for short) Silverlight 4 application you may be able to start a new app in a new process if it is a COM Automation server. For example:-

dynamic excel = ComAutomationFactory.CreateObject("Excel.Application"); 

Should fire up Excel in its own procress.


There is no short answers, but there is a complex one...

If you are runnign SL4 Out-Of-Browser, and you indicated that you are ok running elivated (which really mean SL doesnt run in IE-Protected mode, but rather as standard app...) there is a way for you by using WMI to basically do ANY THING you want to. This blog post will help you - http://justinangel.net/CuttingEdgeSilverlight4ComFeatures . Just keep in mind, this is high end fancy coding, so watch yourself ;)

There are two great sample chapters on Windows Phone and Silverlight for Windows Phone on the LearningWindosPhone.com site. There is great Windows Phone Trainng material , and dont forget the Windows Phone Develoeprs Blog


If you are running your application either in the browser or as a standard out of browser application, being able to start another process would break the Silverlight model, allowing your application access to the machine outside the browser sandbox.

A full trust application will be able to do this.

Why do you want to start another process?


If you are using Silverlight inside an ASPX page you could use HtmlDocument.Window.Invoke to call a JavaScript function which could in turn call a static method within your page (using WebMethod attribute)

The article here describes the JS/ASPX bridge well.

Kindness,

Dan

NB: Not sure I agree with what you are trying to do; just want to help you do it :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜